There are dozens of available tools to merge conflicts, such as Meld, Kaleidoscope or even XCode's own FileMerge. The problem with such tools is that they often have a steep learning curve which is not ideal in a world where fast development is an absolute must.
Github has recently launched Atom, a "hackable text editor for the 21st Century". Along with a great deal of core features, Atom is extremely extendable through packages and customisable through themes.
Atom's merge-conflicts package
Merge-conflicts is a package that makes merging conflicts really easy and straight-forward. By highlighting the conflicts with a green and blue color and allowing for easy 1-click fixes, it has certainly become my weapon of choice for tackling merging issues.
How to install and use
Atom is only officially available for OS X, but as it is an open-source software there are a few builds laying around for Linux and Windows. The installation of those builds won't be covered in this tutorial.
Head over to https://atom.io/ and download and install the editor.
Open up the Atom's Preferences (⌘ ;) and click the Packages menu at the sidebar.
You should then search for "merge-conflicts".
At the time of this writing, two different results show up for the merge-conflicts package, however one of them is deprecated.
You should install the one that's named "Merge Conflicts", and not the "Git Merge Conflicts" package.
If your git binary is installed in
/usr/local/bin/git, then you're ready to go.
However, if you're like me and installed XCode, then your git path is not exactly that. Fire up your terminal, and execute the following command:
Copy the result to your clipboard. Open up the merge-conflicts package settings and paste it under the "Git Path" text field.
You may also want to configure your keymap for this plugin but this is optional, of course :)
Using the plugin
The fun begins now. Open up any file that needs to have conflicts merged, open up the Packages Menu, choose Merge Conflicts and then click Detect:
All your conflicts will then be highlighted in green, indicating your own changes, and blue, the other person changes.
There will also be a list of all resolved and unresolved conflicts at the bottom of the screen:
You can easily fix the conflicts by clicking the button near the version of the file you want. You can also edit either of the versions and click the button accordingly.
After you're done, you'll see something like this:
You can then choose the stage the file, or just git add it later.
And that's it!
No need to mess around in the terminal for simple merges that you won't regularly do. You may want to leverage faster or more powerful tools if this is a thing that you regularly end up doing.
However, for someone that just wants a simple and fast way to solve conflicts, Atom's merge-conflicts package is the way to go!
I'm available on Twitter: @ruigomeseu. Feel free to follow me :)