Git: how to create different unmerged states?

限于喜欢 提交于 2019-11-29 01:44:53

You can get all three by renaming a file differently in each branch.

git init
touch foo
git add foo
git commit -m 'initial commit'
git checkout -b tmp
git mv foo X
git commit -m 'rename to X'
git checkout -
git mv foo Y
git commit -m 'rename to Y'
git merge tmp

Now you have all three states.

$ git status
# On branch master
# Unmerged paths:
#   (use "git add/rm ..." as appropriate to mark resolution)
#
#       added by them:      X
#       added by us:        Y
#       both deleted:       foo
#
no changes added to commit (use "git add" and/or "git commit -a")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!