git 的分支體系命令匯總

來源:互聯網
上載者:User

標籤:

Git 分支結構,就是就是tree,然後合并。

  1.分支的切換和合并

  git checkout -b new-branch-name:可以快速建立並且切換到新的分支。

  git checkout  branch-name:可以快速切換到分支。

  git branch: 可以展示當前所有的分支。

  git checkout -d branch-name:可以用來刪除分支。

  git merge branch-name:用來合并當前分支和別的分支。

    @warning:git status 查看當前衝突;git : 開啟圖形化工具來進行對比。最後commit直接提交就好。

  

  2.分支的管理

  git branch -v :展示當前分支以及最後提交的log

  git branch --merged:展現當前合并了的分支

  git branch --no-merged:展現當前未合并的分支

 

  3.遠程分支

  git remote add 添加遠程分支,git remote rename 重新命名

  git fetch remote-name:從遠端資料庫拉取資料

  git push resposity-name branch-name: 將本機資料進行推送

  git merge reposity-name/branch-name:將遠端資料和本地進行合并。

 

  從遠程分支直接checkout的自動跟蹤(git checkout --track origin/serverfix)。

  所以可以使用以下命令進行跟新和推送:

  git push,git pull

  

  刪除:git push [遠程名] :[分支名] 

git 的分支體系命令匯總

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.