---解決git pull 后出現沖突的解決方法


0.  git status
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 3 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

這是分支產生了分叉現象(就是你的分支和服務器的對應分支有共同基點,然后向不同方向發展)

1. git pull
它包括了兩個命令(git fetch; git merge)

Auto-merging a.c
CONFLICT (content): Merge conflict in a.c
Automatic merge failed; fix conflicts and then commit the result.

這是自動merge沖突產生了!

解決沖突方法:
A: git add a.c (直接編輯a.c文件, 然后git add a.c, 然后git ci )

a.c 沖突文件的沖突區域
1 111111111111
  2 222222222222
  3 <<<<<<< HEAD
  4 aaaaaaaaaaa
  5 =======
  6 bbbbbbbbbbbb
  7 >>>>>>> 064a9cbd32788b914965bc2e707b6485f354c2c0
  8 333333333333

064a9... 是要過來merge的分支, HEAD 就是當前分支的頂端了
====== 是各自的更改的分割線了

B: undo 這個 merge動作用如下命令

git merge --abort


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM