简体   繁体   中英

Git rebase changes onto master from an ancestor

So i've got the following situation where we branched for our release and continued enhancements are being added to master.

A---B---C---Q---W---E---R---T  master
     \         /
      D---E---F Release 1
               \
                G---H---I Release Fixes

Changes up to F of 'Release 1' are merged back into 'master'. Is there a way to rebase/replay the 'Release Fixes' change back onto 'master'?


Edit

To provide more information, I have done a cherry-pick of a series of commits and some of the inspected files don't seem to be at the right version. If a merge is suggested, is it possible to do a merge between two commits?

Yes, the rebase command would be:

git rebase --onto master F I      #<realse1>..<release-fixes>

Not that this will remove commits G, H, and I from F and create G', H', and I' on T. If you want to leave G, H, and I in-place then you'd do:

git checkout master
git cherry-pick G H I    # <release1>..<release-fixes>

[edit] or, as +kirelagin points out, just do a merge to leave them in place.

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