简体   繁体   中英

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. 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? "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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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