No one likes conflits. But we should not be scared of resolving them. Git provide us wit a merging tool which will be triggered if there are changes on same lines form different sources. Or when on line was deleted in first src and added in another. Marge conflict can accrue during: merge, rebase, pull, stash apply, cherry-pick commands.

If you find yourself in a situation that you can not resolve conflict without braking the code or perhaps you need to discuss the marge with your team mate you might abort merge even when you are halfway in resolving this conflict.

To abort git merge use:

# for merge conflicts use
git merge --abort

# for rebase conflicts use
git rebase --abort

Configure git mergetool

You can use one of git extension to resolve conflicts in more present way. Before you use mergetool you need to make some configuration. There are many free and paid extension available ( opendiff, kdiff3, tkdiff, xxdiff, meld, tortoisemerge, gvimdiff, diffuse, diffmerge, ecmerge, p4merge, araxis, bc, codecompare, smerge, emerge, vimdiff, nvimdiff ):

# mergetool will not work out of the box
$ git mergetool

This message is displayed because ‘merge.tool’ is not configured.
See ‘git mergetool –tool-help’ or ‘git help config’ for more details.
‘git mergetool’ will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare smerge emerge vimdiff nvimdiff

Would love your thoughts, please comment.x