我正在使用 SourceTree 来执行/管理我的文件提交、推送、 pull 和 merge 。
我使用 BeyondCompare 作为外部 merge/差异工具,并在选项中进行了设置。在处理其中一个 merge 冲突时,我启动了 Bcomp;这会 pop 3 个 Pane ,它们的文件名以 .LOCAL、.REMOTE 和 .MERGED 结尾,顺序与我在源代码树命令行中提到的相同。
这是困惑和问题 - 我注意到 .LOCAL 文件具有 .REMOTE 的内容,而 .REMOTE 具有我的本地更改,就好像它试图以完全相反的方式理解它一样。只是根本不明白这个。我在 Bcomp 或 SourceTree 中是否有错误的设置/配置导致了相反的内容?
我的理解是:
- Local : 意思是我在本地进行了更改并且在 pull 其他文件时发生了冲突
- Remote:是已经推送到我之前推送到 master 的文件/内容,是我正在 pull 或 merge 的东西。
有时我会在 merge 文件中看到这个
<<<< HEAD
==========
>>>>>
有人能告诉我们什么时候得到它吗?如果我使用像 Bcomp 这样的外部 merge 工具,它会发生吗? GIT放这些是不是说明了什么,需要我们手动去掉,保存文件,避免编译错误
最佳答案
参见“git rebase
, keeping track of 'local' and 'remote'”,我在其中解释了 rebase 开关ours
( rebase 开始前的当前分支)和他们的
(你想要 rebase 的上游分支) ).
作为torek在“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".
在这种情况下:
+--------------------------------+
| LOCAL | BASE | REMOTE |
+--------------------------------+
| MERGED |
+--------------------------------+
- local 引用部分 rebase 的提交:“
ours
”(上游分支) - remote 指传入的更改:“
theirs
”- rebase 前的当前分支。
关于git - .REMOTE 和 .Local 结果相反,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29324812/