Is there any difference between `git merge origin master` and `git merge origin/master`?

元气小坏坏 提交于 2020-01-11 04:57:05

问题


Can any body explain the difference between git merge origin master and git merge origin/master?

I did accidentally did git merge origin master. If it is different, what is the command to reset that merge?


回答1:


After my test, $git merge origin master equals $git merge origin/HEAD master.

This means merge two branch (origin/HEAD, master) into current branch, which is very different from $git merge origin/master.

But as usually, master branch and origin/HEAD is in the same commit line, so these two command performs the same.

And I try the case in which master and origin/HEAD diverged, the result shown as the following with $git merge origin master:

*-.   33f82cd (HEAD, test) merge
|\ \  
| | * 46d0c92 (master) 22
| * | 9d9f51c (origin/test, origin/HEAD) 11
| |/  
* | 5ecfebd (origin/master) modify 2.txt
|/  
* 14949b6 remove 1.txt


来源:https://stackoverflow.com/questions/14243569/is-there-any-difference-between-git-merge-origin-master-and-git-merge-origin

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!