模擬場景
現在有兩個分支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步驟。