zoukankan      html  css  js  c++  java
  • Git常用命令

    特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过。如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/mao2080/

    -------------------------------------常用命令-------------------------------------

    拉取分支:git clone git@git.n.xxx.com:xxx/xxx.git

    获取最新:git fetch (git fetch -p可以实现在本地删除远程已经不存在的分支)

    查看修改文件:git diff

    查看修改状态:git status

    添加到本地仓库:git add .

    提交到本地仓库:git commit -m "remake"

    强制同步所有分支状态:git pull --prune

    -------------------------------------branch相关命令-------------------------------------

    创建分支:git checkout -b <branchName>

    查看分支:git branch -a

    删除本地分支:git branch -d <branchName>

    删除远程分支:git push origin --delete <BranchName>

    切换分支:git checkout <branchName>

    提交到远程仓库:git push origin <branchName>

    强制拉取某个分支最新代码并覆盖本地:git fetch --all git reset --hard origin/<branchName> git pull

    -------------------------------------tag相关命令-------------------------------------

    创建本地标签:git tag <tagName>

    推送指定标签到远程仓库:git push origin <tagName>

    推送多个标签到远程仓库:git push origin --tags

    查看标签详情:git show <tagName>

    查看本地标签:git tag

    查看远程标签:git ls-remote --tags origin

    删除本地标签:git tag -d tagName

    删除远程标签:git tag origin :refs/tags/tagName

    -------------------------------------切换仓库相关命令-------------------------------------

    git remote set-url origin http://jcode.cbpmgt.com/git/<your rep name>.git/

  • 相关阅读:
    PHP 开发 APP 接口 学习笔记与总结
    Java实现 LeetCode 43 字符串相乘
    Java实现 LeetCode 43 字符串相乘
    Java实现 LeetCode 43 字符串相乘
    Java实现 LeetCode 42 接雨水
    Java实现 LeetCode 42 接雨水
    Java实现 LeetCode 42 接雨水
    Java实现 LeetCode 41 缺失的第一个正数
    Java实现 LeetCode 41 缺失的第一个正数
    Java实现 LeetCode 41 缺失的第一个正数
  • 原文地址:https://www.cnblogs.com/mao2080/p/11162244.html
Copyright © 2011-2022 走看看