让git pull --rebase保留合并提交 [英] Make git pull --rebase preserve merge commits

查看:311
本文介绍了让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 后变成 -

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.

推荐答案

您可以在 fetch 和<$ c中拆分 pull $ c $> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆