简体   繁体   中英

git rebase -i a branch onto itself

I had the following in my repo

Master---
     \
       Next-->Commit A.1,Commit A.2,Commit A.3 --......

I want to fix-up the A.* commits into one commit describing the feature A. I tried git rebase -i origin next , but that didn't work how I expected. Is there any way of accomplishing this?

I thought of creating a branch foo, which is essentially next, and then rebase next onto foo followed by merge/delete foo. However, this seems sloppy.

You just need to do:

git rebase -i <COMMIT-ISH>

... where <COMMIT-ISH> is some way of referring to the commit marked Master in your diagram. If there's a branch pointing to that point (probably master or origin/master ) then git log --decorate will show that.

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