How to resolve merge-conflicts in git

Tags: |

<html>
<head>
<<<<<<< HEAD
<link type="text/css" rel="stylesheet" media="all" href="style.css" />
=======
<!-- no style -->
>>>>>>> master
</head>
<body>
<h1>Hello,World! Life is great!</h1>
</body>
</html>

When you receive CONFLICT, your current branch got changed with (no branch).

Try: git mergetool

The command doesn’t necessarily open a GUI unless you install one. Running git mergetool for me resulted in meld being used.

You may install one of the following tools to use it instead: meld, opendiff, kdiff3, tkdiff, xxdiff, tortoisemerge, gvimdiff, diffuse, ecmerge, p4merge, araxis, vimdiff, emerge.

It opens a GUI that steps you through each conflict, and you get to choose how to merge. Sometimes it requires a bit of hand editing afterwards, but usually it’s enough by itself. It is much better than doing the whole thing by hand certainly.

Then you can easily push your changes to remote branch.

git push origin current_branch


Thanks for reading!