In a git merge conflict, what are the BACKUP, BASE, LOCAL, and REMOTE files that are generated?

Git performs a three-way merge, finding the common ancestor (aka "merge base") of the two branches you are merging. When you invoke git mergetool on a conflict, it will produce these files suitable for feeding into a typical 3-way merge tool. Thus:

  • foo.LOCAL: the "ours" side of the conflict - ie, your branch (HEAD) that will contain the results of the merge
  • foo.REMOTE: the "theirs" side of the conflict - the branch you are merging into HEAD
  • foo.BASE: the common ancestor. useful for feeding into a three-way merge tool
  • foo.BACKUP: the contents of file before invoking the merge tool, will be kept on the filesystem if mergetool.keepBackup = true.

In case of pulling (merging) in changes from a online repository into your local copy, you can understand REMOTE, LOCAL and BASE as:

  • REMOTE = Your local file including own modifications ('as on the filesystem')
  • LOCAL = The remote file inside the online repository ('changes made by other users')
  • BASE = The origin of both files ('without any modifications')

enter image description here

The terms are from the point of view of the online repository which is what 'local' refers to. See also the wikipedia article about three-way merge.

Tags:

Git