git clone https://gist.github.com/abef31ca104ecffa2d99fb904aadcf59.git git-mergingcd git-merging
Merge the change-value branch into master, to bring in the change of value:
git merge origin/change-valuewill fail with "Automatic merge failed; fix conflicts and then commit the result."- Edit
app.pland keep the top block after the conflict marker, make the change from7to42and delete the unused block and all conflict markers. git add app.plgit commit
Tip: if it goes wrong when editing, run git merge --abort and start again.
The git log will now contain the original master commits, the change from 7 to 42 and then a merge commit that brings both together (with your alteration).
Check out the change-value branch and rebase (update it) on master.
git checkout change-valuegit rebase master- Edit
app.pland keep the top block after the conflict marker, make the change from7to42and delete the unused block and all conflict markers. git add app.plgit rebase --continue
Tip: if it goes wrong when editing, run git rebase --abort and start again.
The git log will now contain all of the master commits, then a single change from 7 to 42 in the refactored method from master.
If you now repeated the merge of change-value into master, it would merge
cleanly.