git正确进行merge

➜  sohuvideo_harmony_demo git:(developer_local1) git merge developer_local2
Auto-merging entry/src/main/ets/pages/lzy/ComponentLearnPage.ets
CONFLICT (content): Merge conflict in entry/src/main/ets/pages/lzy/ComponentLearnPage.ets
Automatic merge failed; fix conflicts and then commit the result.
➜  sohuvideo_harmony_demo git:(developer_local1)git status
On branch developer_local1
You have unmerged paths.
  (fix conflicts and run "git commit") // 这个意思是冲突解决后,用commit命令提交
  (use "git merge --abort" to abort the merge)
// merge会把有冲突的文件列出来
Unmerged paths:
  (use "git add ..." to mark resolution) // 这个意思是,冲突文件解决后,用add把冲突的文件标记为已解决状态
        both modified:   entry/src/main/ets/pages/lzy/ComponentLearnPage.ets

no changes added to commit (use "git add" and/or "git commit -a")
➜  sohuvideo_harmony_demo git:(developer_local1)git status
On branch developer_local1
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add ..." to mark resolution)
        both modified:   entry/src/main/ets/pages/lzy/ComponentLearnPage.ets

no changes added to commit (use "git add" and/or "git commit -a")
➜  sohuvideo_harmony_demo git:(developer_local1)git commit 
U       entry/src/main/ets/pages/lzy/ComponentLearnPage.ets
error: Committing is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm '
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
➜  sohuvideo_harmony_demo git:(developer_local1)git add .
➜  sohuvideo_harmony_demo git:(developer_local1)git status
On branch developer_local1
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Changes to be committed:
        modified:   entry/src/main/ets/pages/lzy/ComponentLearnPage.ets

➜  sohuvideo_harmony_demo git:(developer_local1)git commit 
[developer_local1 1a147c0] Merge branch 'developer_local2' into developer_local1
➜  sohuvideo_harmony_demo git:(developer_local1) git status
On branch developer_local1
nothing to commit, working tree clean

解决完冲突,add之后,也可以采用git merge --continue完成合并

参考

git commit
git merge 冲突解决

你可能感兴趣的:(GIT,git)