user3113427
user3113427

Reputation: 465

is there any difference between merging from diff branch in git

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?

Upvotes: 0

Views: 41

Answers (2)

Monte Goulding
Monte Goulding

Reputation: 2420

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.

Upvotes: 1

Franck
Franck

Reputation: 1394

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.

Upvotes: 0

Related Questions