Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between 'remote', 'local', and 'base' using p4merge

Tags:

git

merge

p4merge

I'm merging my branch on the master branch using the p4Merge tool, and I see three views:

LOCAL
REMOTE
BASE

What are the differences between these views?

like image 399
slacky82 Avatar asked Apr 28 '17 15:04

slacky82


People also ask

What is base local and remote?

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')

What is base local remote in kdiff3?

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.

What is base version in Git?

BASE is in fact the common ancestor, MERGED is the name of the file with the partial merge information in it. Please see my question and answer Setting up and using Meld as your git difftool and mergetool which explains exactly how it works.

When rebasing What is the remote?

remote refers to the incoming changes: " theirs " - the current branch before the rebase.


3 Answers

This video tutorial does a good job of explaining what each of these views mean:

4-pane merge tools show you these panes:

  • LOCAL – your file with the changes you’ve made to it
  • BASE – the common ancestor file that LOCAL and REMOTE came from
  • REMOTE – the file you’re merging in, possibly authored by someone else
  • MERGE_RESULT – the file resulting from the merge where you resolve conflicts

We could visualize the history of the file as follows:

remote: ... v1 -- v2 -- v3
                   \
local:              v4

Here v3 would be the REMOTE version of file, and v4 is the LOCAL version. The BASE is v2, and the MERGE_RESULT is the file which would result from merging the remote into the local file.

like image 160
Tim Biegeleisen Avatar answered Oct 24 '22 15:10

Tim Biegeleisen


If you're using Sourcetree you can see the following. Which is what Tim suggested above.

Enter image description here

like image 20
kouretinho Avatar answered Oct 24 '22 16:10

kouretinho


P -- B
 \
  A
git checkout A
git merge B    #merge B into A
  • local = A
  • remote = B
  • base = P

I would add that on a rebase, local and remote are reversed.

P -- B
 \
  A
git checkout A
git rebase B    #rebase A onto B
  • local = B
  • remote = A
  • base = P
like image 26
Fuyu Persimmon Avatar answered Oct 24 '22 14:10

Fuyu Persimmon