git命令合master和其他分支代碼

模擬場景

現在有兩個分支master(主分支)和other,你在other分支上開發代碼了,現在想將other分支合併到master。項目有可能有很多的分支,例如項目分支master、other、other1、other2等分支都需要將代碼合併到master上的,進行發佈上線。

step1

分別切換到other、master拉取最新代碼

git  pull
step2

將master代碼合併到other分支,首先切換到other分支

git checkout other

然後將master代碼合併到other

 git merge master

最後注意如果有衝突需要解決衝突,沒有衝突也需要push代碼

git push
step3

切換到master分支,將other代碼合併到master上,如果2步驟。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章