git 产生冲突的解决办法

解决冲突

1.当master和test分支都commit了相同的文件时,就不能采用快进提交的方式
2.强行合并的结果如下

$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
#
# Unmerged paths:
#   (use "git add/rm ..." as appropriate to mark resolution)
#
#       both modified:      readme.txt
#
no changes added to commit (use "git add" and/or "git commit -a")

3.查看冲突
使用$ vi readme.txt查看文件内容

Git is a distributed version control system.
Git is free software distributed under the GPL.
Git has a mutable index called stage.
Git tracks changes of files.
<<<<<<< HEAD
Creating a new branch is quick & simple.
=======
Creating a new branch is quick AND simple.
>>>>>>> feature1

Git用<<<<<<<=======>>>>>>>标记出不同分支的内容,修改成:
Creating a new branch is quick and simple.
git addgit commit即可


$ git log --graph --pretty=oneline --abbrev-commit
可查看分支情况

你可能感兴趣的:(git学习)