使用 p4merge 'remote'、'local' 和 'base' 之间的区别

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

我正在使用 p4Merge 工具在 master 分支上合并我的分支,我看到三个视图:

LOCAL
REMOTE
BASE

这些观点有什么区别?

This video tutorial 很好地解释了每个观点的含义:

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

我们可以将文件的历史可视化如下:

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

这里v3是文件的REMOTE版本,v4LOCAL版本。 BASEv2MERGE_RESULT 是将远程文件合并到本地文件后的文件。

如果您使用的是 Sourcetree,您可以看到以下内容。这就是上面时间建议的。

P -- B
 \
  A
git checkout A
git merge B    #merge B into A
  • 本地=A
  • 远程 = B
  • base = P

我要补充一点,在变基上,本地和远程是相反的。

P -- B
 \
  A
git checkout A
git rebase B    #rebase A onto B
  • 本地=B
  • 远程 = A
  • base = P