I have two features I\'m working on
Shared -- Commits -- A -- B -- C Feat1
Shared -- Commits -- D -- E -- F Feat2
The problem is that to test Feat2 I rea
There are basically two options here.
feat2
to combo
.To cherry pick new commits on feat2
to combo
, run the following:
git checkout combo
git cherry-pick <new commit> <new commit> <new commit>
Or alternately, you can merge instead of rebasing. E.g. To create combo:
git checkout -b combo feat1
git merge feat2
Then, to "merge in new changes" from feat2
, just...
git merge feat2
Likewise, to merge in new commits on feat1
:
git merge feat1
You can merge instead of rebase. Since your combo branch is just for testing, you don't have to worry about the history being a bit messier.
That is:
git checkout feat2
git branch -b combo
git merge feat1
Later, when you update feat2:
git checkout combo
git merge feat2
Whenever you make an update to feat1 or feat2, merge that into combo.
The disadvantage is that you'll have to merge all commits in both branches. If there are changes you don't want, you'll have to make a separate commit removing those changes in the combo branch.
You can rebase the additional commits from feat2 onto combo.
Suppose you add some commits onto feat2, then to move these commits to combo:
git rebase --onto combo lastcommittoexcludeonfeat2 feat2
Alternatively, before you make the changes to feat2, add a branch or tag, eg:
git checkout -b lastfeat2rebase
git checkout feat2
git commit ... # more commits here to feat2
git rebase --onto combo lastfeat2rebase feat2
Please note, that once you go with the rebase option, you cannot use the merge option anymore. If you use the merge option, you can later decide to go with the rebase option.