当前分支和master分枝分别有更新的时候
- 在执行git merge 合并分支的时候就可能起冲突 报错如下
$ git merge feature1
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
Automatic merge failed; fix conflicts and then commit the result.
- Git告诉我们,readme.txt文件存在冲突,必须手动解决冲突后再提交。
git status也可以告诉我们冲突的文件:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: readme.txt
no changes added to commit (use "git add" and/or "git commit -a")
手动解决冲突后再次提交
git add readme.txt
删除分支$ git branch -d feature1
网友评论