Git merge conflicts are shown like this usually:
<<<<<<< HEAD:file.txt Code changed by A ======= Code changed by B >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
However, I know it is possible (with some git config option) to to also show the original code, and not only the changes. Something like:
<<<<<<< HEAD:file.txt Code changed by A ======= Original code ======= Code changed by B >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
However, I can't find the option anymore... anyone can help me out?
You can use the git reset --merge command. You can also use the git merge --abort command. As always, make sure you have no uncommitted changes before you start a merge.
To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<< . When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD .
To fix this situation, you need to create new commits that mimic those on the branch. The easiest way to do that is with git rebase -f . Now you can merge branch in again.
Never mind, I just found the solution:
git config --global merge.conflictstyle diff3
It actually looks like this:
<<<<<<< HEAD:file.txt Code changed by A ||||||| merged common ancestors Original code ======= Code changed by B >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With