Wednesday 15 August 2012

git - What is the difference between merging master into branch and merging branch into master? -



git - What is the difference between merging master into branch and merging branch into master? -

i have branch called master , called dev. usually, tests , improvements on dev, , when decided ok, merge master, tagging , release new version of application. met 2 cases of merging:

merge master dev, and merge dev master,

but not sure how 2 different... explanation welcome.

merging 1 branch not symmetric operation:

merging dev master, and merging master dev,

are, in general, not equivalent. here illustrative illustration explains difference between two. let's assume repo looks follows:

if merge dev master

if master checked out (git checkout master),

and merge dev (git merge dev), end in next situation:

the master branch points new merge commit (f), whereas dev still points same commit (e) did before merge.

if merge master dev

if, on other hand, dev checked out (git checkout dev),

and merge master (git merge master), end in next situation:

the dev branch points new merge commit (f', whereas master still points same commit did before merge (d).

putting together

git merge

No comments:

Post a Comment