合并分支基本流程
-
前提
- 已存在master和branch_1
-
切換到合并基準(zhǔn)分支(此處我切換到branch_1)
# 切換到branch_1分支 $ git checkout branch_1 Switched to branch 'branch_1'
-
使用
git merge
命令合并分支# 使用merger命令合并 $ git merge # 若有沖突, 會(huì)顯示類似下面的內(nèi)容 Auto-merging index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. # 若不存在沖突, 合并便成功
-
使用
git status
, 查看合并詳情, 類似$ git status On branch master You have unmerged paths. (fix conflicts and run "git commit") Unmerged paths: (use "git add <file>..." to mark resolution) both modified: index.html no changes added to commit (use "git add" and/or "git commit -a")
進(jìn)入文件, 手動(dòng)解決沖突
-
加入緩存區(qū)
$ git add
-
提交合并
$ git commit -m "information"