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.
DESCRIPTION. git merge-base finds best common ancestor(s) between two commits to use in a three-way merge. One common ancestor is better than another common ancestor if the latter is an ancestor of the former. A common ancestor that does not have any better common ancestor is a best common ancestor, i.e. a merge base.
A merge conflict is an event that occurs when Git is unable to automatically resolve differences in code between two commits. When all the changes in the code occur on different lines or in different files, Git will successfully merge commits without your help.
It is the first common ancestor. Often it is useful to have this to help decide which of the newer commits you want. Local is your local commit, the one in the current branch you are standing on. Remote is the remote commit, of the branch you are merging into your local one.
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 mergefoo.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 toolfoo.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')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.
According to https://git-scm.com/docs/git-mergetool
When git mergetool is invoked with this tool (either through the -t or --tool option or the merge.tool configuration variable) the configured command line will be invoked with $BASE set to the name of a temporary file containing the common base for the merge, if available; $LOCAL set to the name of a temporary file containing the contents of the file on the current branch; $REMOTE set to the name of a temporary file containing the contents of the file to be merged, and $MERGED set to the name of the file to which the merge tool should write the result of the merge resolution.
However, there seems to be a difference between a rebase command and a merge command.
Merge uses your local branch as LOCAL and the branch you're merging in as REMOTE
Rebase uses your local branch as REMOTE and the branch you're rebasing onto as LOCAL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With