Planning ahead and being aware of what others are working on can help prevent merge conflicts and/or help resolve them earlier -- while the details are still fresh in mind.For example, if you know that you and another person are both working on different refactoring that will both affect the same set of files, you should talk to each other ahead of time and get a better sense for what types of changes each of you is making.Navigate by pressing 'n' (next region), 'p' (prevision region). Emacs asks you if you want to save this buffer: yes.Press 'a' and 'b' to copy mine or theirs region to the output buffer, respectively. After finishing a buffer mark it as resolved by running from the teriminal: You could fix merge conflicts in a number of ways as other have detailed.If you're confused, it's probably best to just call that person into your room so they can see what you're looking at.) If the conflict is longer, then I will cut and paste each of the three sections into three separate files, such as "mine", "common" and "theirs".Then I can run the following commands to see the two diff hunks that caused the conflict: This is not the same as using a merge tool, since a merge tool will include all of the non-conflicting diff hunks too. Somebody already mentioned this, but understanding the intention behind each diff hunk is generally very helpful for understanding where a conflict came from and how to handle it. If it's a buildable project, then build it before you commit, etc.I have found that I think of the tracking branch as the 'missing piece in the middle' between me my local, actual files directory and the remote defined as origin.I've personally got into the habit of 2 things to help avoid this.
As per @Josh Glover comment: The command doesn't necessarily open a GUI unless you install one.It graphically can show the changes between 3 files and it allows automatic merging (when safe to do so) and full control over editing the resulting file. For conflicts that involve more than a few lines, it's easier to see what's going on in an external GUI tool.I like opendiff -- Git also supports vimdiff, gvimdiff, kdiff3, tkdiff, meld, xxdiff, emerge out of the box and you can install others: This will open three buffers (mine, theirs, and the output buffer).Running I find merge tools rarely help me understand the conflict or the resolution.I'm usually more successful looking at the conflict markers in a text editor and using git log as a supplement.It opens a GUI that steps you through each conflict, and you get to choose how to merge.