Difference of merging with the main branch and from the dev branch

Suppose I have a project with two branches. One is the master and the other is dev. I am using git and doing one of the following:

Case 1

git checkout master git merge dev 

Case 2

 git checkout dev git merge master 

My question is: What is the difference between case 1 and case 2?

+4
source share
2 answers
 git checkout master git merge dev 

The "master" branch and merge with the "dev" branch will be checked. Any applicable changes to "dev" will be in "master" after this command completes.

 git checkout dev git merge master 

It will check the "dev" branch and merge with the "master" branch. Any applicable changes to "master" will be in "dev" after the completion of this command.

See Basic Branching and Merging for more information.

+6
source

in the first case, changes made to dev are merged into master (leaving dev unaffected), while in the second case, changes made to master (leaving unfinished master) are merged into dev. See this link for more details.

+5
source

All Articles