简体   繁体   中英

Git rebase branch reapplying patch from master

I started to develop a new feature in master (patch "B"), made a push with it to upstream, and then decided that it needed to mature before staying in master. I branched ("newui") and reverted the new feature in master (patch "B'"). Now I want to rebase the newui branch to the tip of master without losing the "B" feature. Graphically, I want to go from:

    D-E [newui]
   /
A-B-B'-C [master]

To:

         B-D-E [newui]
        /
A-B-B'-C [master]

or:

    B-D-E [newui]
   /
A-C [master]

Cherry-pick patch B onto master, then rebase newui onto master.

You can't collapse AB-B'-C into AC without rewriting history, which is usually a bad plan. (It could be done with git rebase -i .)

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