合并分支基本流程
-
前提
- 已存在master和branch_1
-
切换到合并基准分支(此处我切换到branch_1)
# 切换到branch_1分支 $ git checkout branch_1 Switched to branch 'branch_1'
-
使用
git merge
命令合并分支# 使用merger命令合并 $ git merge # 若有冲突, 会显示类似下面的内容 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")
-
进入文件, 手动解决冲突
-
加入缓存区
$ git add
-
提交合并
$ git commit -m "information"
网友评论