0

Suppose i have Branch A and then i have master branch.

Now i am confused is these two same

git checkout master
git merge Branch A
git push origin master

git checkout Branch A
git merge master
git push origin master

Do they both are same?

user3113427
  • 455
  • 1
  • 6
  • 17
  • 2
    Possible duplicate of [Are merges in Git symmetric?](http://stackoverflow.com/q/12192526/1256452) – torek Jan 14 '14 at 02:21
  • Possible duplicate of [Are merges in Git symmetric?](http://stackoverflow.com/questions/12192526/are-merges-in-git-symmetric) – Tobias Kienzler Feb 27 '17 at 09:53

2 Answers2

1

The answer to this question depends on what you mean by same. As @torek's potential duplicate points out the resulting merge branch will be the same. However, only the checked out branch will have the changes from the other branch merged in. So in your first example the merge commit will be the new head of the master branch but the head of Branch A will remain pointing to whatever it's last commit was.

Monte Goulding
  • 2,380
  • 1
  • 21
  • 25
0

If you compare your branches you will see no difference.

You branch A will have 0 commits ahead and 0 commits behind.

If you have resolved your conflict (if any) they should be similar (in terms of content) but the git log history might be different, at least the merge commits name will be different.

Franck
  • 1,354
  • 12
  • 17