rynmrtn
rynmrtn

Reputation: 3419

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?

Upvotes: 1

Views: 439

Answers (1)

GoZoner
GoZoner

Reputation: 70155

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.

Upvotes: 1

Related Questions