git版本管理系列(九)

git版本管理系列(八)

推送衝突的解決

創建新分支

nelsen-mac:learngit mac$ git checkout -b f1
Switched to a new branch 'f1'

修改文件readme.md,並且commit 到本地倉庫

nelsen-mac:learngit mac$ git add readme.md 
nelsen-mac:learngit mac$ git commit -m'create a conflict'

切換到master分支,修改readme.md文件

nelsen-mac:learngit mac$ git checkout master

然後提交修改 

nelsen-mac:learngit mac$ git commit -m'conflict is coming'

 合併f1分支,提示我們發生了衝突

nelsen-mac:learngit mac$ git merge f1
Auto-merging readme.md
CONFLICT (content): Merge conflict in readme.md
Automatic merge failed; fix conflicts and then commit the result.

 

<<<<<<< HEAD

我是來解決衝突的哦

=======

😁😁😁😁😁😁😁😁 這次是我來解決衝突的

>>>>>>> f1

修改爲:

😁😁😁😁😁😁😁😁 這次是我來解決衝突的

 然後再合併提交

nelsen-mac:learngit mac$ git add readme.md 
nelsen-mac:learngit mac$ git commit -m'now is ok'
[master 4bdd120] now is ok

用 git log --graph --pretty=oneline --abbrev-commit 查看分支合併情況

然後再刪除分支 git branch -d f1 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章