Recent Changes - Search:

Basics

Languages

Tools

OS

Resources

PmWiki

pmwiki.org

edit SideBar

Git /

Conflicts

Conflicts occur when merging branches that both changed the same part of the tracked files. When this happens, git can't perform both changes and marks a conflict within the affected file. Usually, conflicts will be marked as:

<<<<<<< HEAD
The content of the current file
=======
The content of the file in the branch to be merged in
>>>>>>> Message of the latest commit to change that file

To resolve conflicts, you just have to replace all of the above by the content you want, which is presumably a combination of both the current state and the merging branch's state.

It is sometimes useful to see where the two branches diverged, the original content before either branches changed it, like:

<<<<<<< HEAD
The content of the current file
||||||| merged common ancestors
The content of the ancestor file, before either branch changed it
=======
The content of the file in the branch to be merged in
>>>>>>> Message of the latest commit to change that file

This can be achieved by changing your git configurations to a three way diff by typing:

git config merge.conflictstyle diff3

You can then use a variety of tools to look at the example:

git mergetool --tool=meld

Using git mergetool without specifying a tool will list a few defaults programs and attempt to use them until it finds on that works. It is a helpful way to find which tools could be tried.

Edit - History - Print - Recent Changes - Search
Page last modified on December 07, 2016, at 11:14 PM