git pull --rebase和git pull --ff-only之间的区别 [英] Difference between git pull --rebase and git pull --ff-only
问题描述
假设 origin / master
已经提交 A - B - C
和my local / master
已经提交 A - B - D
。
什么会发生如果我使用 git pull --rebase
?
如果我使用 git pull - 只有
?
结果提交树有没有区别?
如果我使用git pull --rebase,会发生什么情况?
git pull --rebase
大致相当于
git fetch
git rebase origin / master
即您的远程更改( C
)将在本地更改( D
)之前应用,导致以下树< a> B - C - D
如果我使用git pull - 只会发生什么?
它会失败。
git pull --ff-only
对应于
git fetch
git merge --ff-only origin / master
- 仅ff
仅适用于远程更改他们可以被快速转发。从该男子:
拒绝合并并以非零状态退出,除非当前HEAD已更新或合并可以被解析为快进
由于您的本地和远程分支已经发生分离,因此无法通过快进和 git pull --ff-only
会失败。
Let's say origin/master
has commit A--B--C
and my local/master
has commit A--B--D
.
What will happen if I use git pull --rebase
?
What will happen if I use git pull --ff-only
?
Is there any difference in the resulting commit tree ?
What will happen if I use git pull --rebase ?
git pull --rebase
is roughly equivalent to
git fetch
git rebase origin/master
i.e. your remote changes (C
) will be applied before the local changes (D
), resulting in the following tree
A -- B -- C -- D
What will happen if I use git pull --ff-only ?
It will fail.
git pull --ff-only
corresponds to
git fetch
git merge --ff-only origin/master
--ff-only
applies the remote changes only if they can be fast-forwarded. From the man:
Refuse to merge and exit with a non-zero status unless the current HEAD is already up-to-date or the merge can be resolved as a fast-forward
Since your local and remote branches have diverged, they cannot be resolved by a fast-forward and git pull --ff-only
would fail.
这篇关于git pull --rebase和git pull --ff-only之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!