问题描述
在 master
中说,我禁用了某个功能。
我在分支功能
上使用该功能,所以我有一个特殊的提交 $
该功能。
现在我想将我在功能
中所做的更改合并到 master
中,但不要进行启用提交。就像
Let's say in master
I have a feature disabled.I work on that feature on branch feature
, so I have a special commit $
there that just enables that feature.Now I want to merge the changes I did in feature
into master
, but keep the enabling commit out. So it's like
main: A--B--X--Y
feature: A--B--$--C--D
因此,我想通过移动 $
在功能之上提交:
So let's say I want to do it, by moving the $
commit on top of feature:
new feature: A--B--C--D--$
我该怎么做?
推荐答案
git rebase -i B
,然后移动 $
到编辑器中显示的列表末尾。它将从打开的文件的第一行开始。您也可以完全删除该行,这只会将该提交从分支机构的历史记录中删除。
git rebase -i B
, and then move $
to the end of the list that shows up in your editor. It will start out as the first line in the file that opens. You could also just delete that line entirely, which will just drop that commit out of your branch's history.
这篇关于Git:将提交“移动到顶部”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!