简体   繁体   English

正确的方法来清理Git功能分支而不合并到master中?

[英]Proper way to clean up a Git feature branch without merging it into master?

I have a feature branch of a fairly large project and I'm looking to rebase it, most likely into 1 (maybe 2) commits. 我有一个相当大的项目的功能分支,并且我希望将其重新设置基础,最有可能转换为1(也许2)个提交。 I do not want to merge this into master yet but just want to prepare it first by cleaning it up. 我还不想将其合并到母版中,而只是想通过清理将其准备好。 What is the proper rebase syntax to do this? 执行此操作的正确的rebase语法是什么? "Rebasing against master" always confuses me regardless of how many times I read it and go over it -- I always worry I'm messing with master or merging the feature branch in. 不管我读过多少遍,“对master降级”总是使我感到困惑–我总是担心自己会与master混为一谈或将功能分支合并到其中。

You should follow the following process. 您应该遵循以下过程。

git pull origin master
git checkout feature
git rebase -i master

Now the last command would open the editor by listing all the commits that would be moved. 现在,最后一个命令将通过列出所有将要移动的提交来打开编辑器。

在此处输入图片说明

I have followed these steps and never face much of an issue. 我遵循了这些步骤,从没有遇到太多问题。 You can read more about it from here . 您可以从此处了解更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM