1. 程式人生 > >git 衝突解決技巧

git 衝突解決技巧

提交版本後出現衝突
如果衝突在同一行,git pull之後再提交就解決了
如果衝突不在同一行 git pull之後也會有衝突
git pull 之後有衝突:
$ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From g:/software/repository/git/itheima26
   50db030..a04027a  master     -> origin/master
Auto-merging readme.txt
CONFLICT (content): Merge conflict in readme.txt
Automatic merge failed; fix conflicts and then commit the result.
解決方法:
1.git mergetool
呼叫上面命令之後會提示你輸入編輯方法,輸入:beyond compare 進入編輯器.
2.編輯完之後.呼叫git commit -a 把當前目錄中所有都提交到本地庫中.
3.git push origin master 提交到遠端庫中.