Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

git-merge

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?

like image 718
Anish Avatar asked Jan 09 '13 18:01

Anish


1 Answers

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
like image 137
pktangyue Avatar answered Oct 17 '22 07:10

pktangyue