什么是 "ours" 和 "their" 同时做 git 变基
What is "ours" and "their" while doing git rebase
我已经应用了以下命令,但在做 rebase 时几乎没有混淆 - 以下命令中我们的和他们的是什么
git checkout app/dashboard-sprint-5
git rebase app/demandware
我知道当前分支是 app/dashboard-sprint-5
并且当我应用 rebase 时。
app/dashboard-sprint-5
将应用在 app/demandware
的顶部。
什么是 ours
和 theirs
的分支。
我检查了link但不满意
简而言之,当我们谈论 rebase 时,ours
表示基础分支。
所以在你的情况下 ours
将是 app/demandware
,因为首先 git 将我们移动到那里,然后应用 app/dashboard-sprint-5
的更改,这将是 theirs
.
例如,这里是 documentation 关于 rebase 和 ours
的注释:
Because git rebase replays each commit from the working branch on top of the <upstream> branch using the given strategy, using the ours strategy simply discards all patches from the <branch>, which makes little sense.
为了容易记住 ours 和 theirs 的方向,将变基视为对当前分支的每个提交进行 cherry-picking到目标分支。
Before rebasing:
A--B--C (master)
'--D--E (devel, HEAD)
Reset HEAD to master:
A--B--C (master, HEAD)
'--D--E (devel)
Cherry-pick D, E.
A--B--C (master)
| '-- D'--E' (HEAD)
'--D--E (devel)
HEAD becomes "ours" and the old devel branch "theirs".
^^^^ ^^^^^^
On success, repoint devel to E':
A--B--C (master)
'--D'--E' (devel, HEAD)
在一个没有冲突的非交互式 rebase 中,看起来我们直接从旧的 devel-branch 历史跳转到 rebased devel-branch 历史。在这个视图中,ours 和 theirs 的倒置并不明显,导致潜在的混淆,尤其是在合并冲突解决期间——它只是一个有点出乎意料,我们开始的分支可能突然被合并工具称为"remote branch"。
虽然这个问题已经回答了,但我添加了这个更直观的解释,因为我发现没有它很难记住结果。
我已经应用了以下命令,但在做 rebase 时几乎没有混淆 - 以下命令中我们的和他们的是什么
git checkout app/dashboard-sprint-5
git rebase app/demandware
我知道当前分支是 app/dashboard-sprint-5
并且当我应用 rebase 时。
app/dashboard-sprint-5
将应用在 app/demandware
的顶部。
什么是 ours
和 theirs
的分支。
我检查了link但不满意
简而言之,当我们谈论 rebase 时,ours
表示基础分支。
所以在你的情况下 ours
将是 app/demandware
,因为首先 git 将我们移动到那里,然后应用 app/dashboard-sprint-5
的更改,这将是 theirs
.
例如,这里是 documentation 关于 rebase 和 ours
的注释:
Because git rebase replays each commit from the working branch on top of the <upstream> branch using the given strategy, using the ours strategy simply discards all patches from the <branch>, which makes little sense.
为了容易记住 ours 和 theirs 的方向,将变基视为对当前分支的每个提交进行 cherry-picking到目标分支。
Before rebasing:
A--B--C (master)
'--D--E (devel, HEAD)
Reset HEAD to master:
A--B--C (master, HEAD)
'--D--E (devel)
Cherry-pick D, E.
A--B--C (master)
| '-- D'--E' (HEAD)
'--D--E (devel)
HEAD becomes "ours" and the old devel branch "theirs".
^^^^ ^^^^^^
On success, repoint devel to E':
A--B--C (master)
'--D'--E' (devel, HEAD)
在一个没有冲突的非交互式 rebase 中,看起来我们直接从旧的 devel-branch 历史跳转到 rebased devel-branch 历史。在这个视图中,ours 和 theirs 的倒置并不明显,导致潜在的混淆,尤其是在合并冲突解决期间——它只是一个有点出乎意料,我们开始的分支可能突然被合并工具称为"remote branch"。
虽然这个问题已经回答了,但我添加了这个更直观的解释,因为我发现没有它很难记住结果。