git rebase upstream / master vs git pull --rebase upstream master [英] git rebase upstream/master vs git pull --rebase upstream master
问题描述
在> git rebase upstream / master
和 git pull --rebase upstream master
之间是否有区别,if所以呢?远程可以是任何远程的,不一定是上游的。 git fetch
)首先,更新 upstream / master
提交。
/ em>第一次更新 upstream / master
,你不会得到相同的结果。
SnakE 提及在评论中, 在这种情况下, 这里: 这与 为此,它查看远程的reflog跟踪分支(在这种情况下 对于每个reflog条目,( Is there a difference between The If you just rebase without first updating I illustrate it in " SnakE mentions in the comments that What Here: This differs from To do this, it looks at the reflog of the remote tracking branch ( For each reflog entry, (
这篇关于git rebase upstream / master vs git pull --rebase upstream master的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! master
分支和' origin / master
'已经发散,如何'分支'分支'?/ b>
git pull --rebase
不是正好 git f蚀刻&& git rebase origin / master
。
请参阅 git pull --rebase
do?
(origin / master)
|
A - B - C(主)
\
B' - D(更改B和强制推后的实际原点/主)
git fetch origin
git rebase --onto origin / master B master
origin / master
( B'
)
B
是旧的 origin / master
(在获取更新之前)
master
是在 origin / master
$ b $之上重播的分支b git fetch
+ git rebase origin / master
的区别在于 pull --rebase
命令试图找出哪些提交是真正的你的本地提交,哪些提交来自上一次提取的上游。
origin / master
)。此reflog表示以最近的第一个顺序在 origin
上对 git fetch
操作的提示。
origin / master @ {1}
,然后 ... { 2}
等),它会检查该提交是否是当前分支头 master
的祖先。只要它找到一个,它就会选择它作为rebase的起点(上例中 B
)。
git rebase upstream/master
and git pull --rebase upstream master
, and if so, what? The remote could be any remote, not necessarily upstream.git pull --rebase
will fetch (git fetch
) first, updating upstream/master
commits.upstream/master
, you won't get the same result.master
branch and 'origin/master
' have diverged, how to 'undiverge' branches'?"
git pull --rebase
isn't exactly git fetch && git rebase origin/master
.
See "what does "git pull --rebase
" do?"(origin/master)
|
A--B--C (master)
\
B'--D (actual origin/master after changing B and force pushing)
git pull --rebase
does, in this case, is:git fetch origin
git rebase --onto origin/master B master
origin/master
(B'
)B
is the old origin/master
(before a fetch updated it)master
is the branch to replay on top of origin/master
git fetch
+ git rebase origin/master
in that the pull --rebase
command tries to find out which commits are really your local ones, and which had come from upstream in an earlier fetch.
origin/master
, in this case). This reflog represents the tips of successive git fetch
operations on origin
, in "most recent first" order.origin/master@{1}
, then ...{2}
, and so on) it checks if that commit is an ancestor of the current branch head master
. As soon as it finds one, it picks it as the starting point for the rebase (B
in the example above).