4

I am using SourceTree for performing/managing my file commits, pushes, pulls and merges.

I use BeyondCompare as the external Merge/Diff tool and have it set in the options. While managing one of the merge conflicts, I launched the Bcomp; this brings up 3 panes ending with .LOCAL, .REMOTE and .MERGED in their file names and the order is same as I mentioned in the Source Tree command line.

Here is the confusion and the issue - I notice that the .LOCAL file has the content of the .REMOTE and .REMOTE has my local changes as if it's trying to understand it in exactly opposite way. Just don't get this at all. Do I have a bad setting/config in Bcomp or SourceTree that is resulting in opposite content?

My understanding is :

  • Local : meaning the file I have made my changes locally and have got the conflict upon while pulling others
  • Remote : Is the file/content that has been pushed to pushed to the master ahead of me and is something I am pulling or merging with.

Sometimes I see this in the merged files

<<<< HEAD
    ========== 
    >>>>> 

Can someone tell what when exactly do we get it, and will it ever happen if I use external merge tool like Bcomp. Does GIT put these to indicate something, and we need to manually remove it and save the file to avoid compilation errors

jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

3

See "git rebase, keeping track of 'local' and 'remote'", where I explained a rebase switches ours (current branch before rebase starts) and theirs (the upstream branch on top you want to rebase).

As torek expained in "What is the precise meaning of “ours” and “theirs” in git?"

The reason the "ours" and "theirs" notions get swapped around during rebase is that rebase works by doing a series of cherry-picks, into an anonymous branch (detached HEAD mode).
The target branch is the anonymous branch, and the merge-from branch is your original (pre-rebase) branch:
so "--ours" means the anonymous one rebase is building while "--theirs" means "our branch being rebased".

In that context:

+--------------------------------+
| LOCAL  |     BASE     | REMOTE |
+--------------------------------+
|             MERGED             |
+--------------------------------+
  • local references the partially rebased commits: "ours" (the upstream branch)
  • remote refers to the incoming changes: "theirs" - the current branch before the rebase.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250