使 git pull --rebase 保留合并提交 [英] Make git pull --rebase preserve merge commits
本文介绍了使 git pull --rebase 保留合并提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
git pull --rebase
删除未推送的合并提交.有没有办法让它保存它们?
git pull --rebase
removes unpushed merge commits. Is there a way to make it preserve them?
说我的历史看起来像——
Say my history looks like—
A
|
B H
| |
C G
| |
D F
| /
E
(A
是合并提交.)
在 git pull --rebase
之后它变成了——
After a git pull --rebase
it becomes—
H
|
G
|
F
|
X
|
B
|
C
|
D
|
E
(X
是新提交 git pull --rebase
插入到我的历史记录中.)—A
被删除.
(X
being the new commits git pull --rebase
inserted into my history.)—A
is removed.
我知道你可以使用 git rebase --preserve-merges
用 git rebase
保存它们,但我没有看到用 git pull --rebase
.
I know you can use git rebase --preserve-merges
to preserve them with git rebase
, but I don't see a way to preserve them with git pull --rebase
.
推荐答案
您可以将 pull
拆分为 fetch
和 rebase
you can split your pull
in a fetch
and a rebase
git fetch origin master
git rebase origin master --preserve-merges
这篇关于使 git pull --rebase 保留合并提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文