Difference between 'remote', 'local', and 'base' using p4merge
Asked Answered
S

3

11

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?

Seedtime answered 28/4, 2017 at 15:13 Comment(1)
Why is a Perforce tool used for Git?Logarithmic
T
11

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.

Tema answered 28/4, 2017 at 15:19 Comment(2)
link doesn't work. Please see here a short video tutorial from the company behind p4merge perforce.com/video-tutorials/resolving-conflictsInterlard
@Interlard Thanks for letting us know that the link was down.Tema
I
3

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

Enter image description here

Interlard answered 5/9, 2017 at 10:11 Comment(0)
H
2
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
Hoarding answered 29/10, 2018 at 22:18 Comment(1)
"I would add that on a rebase, local and remote are reversed." That was what I was looking for, cheers!Haimes

© 2022 - 2024 — McMap. All rights reserved.