Working on an incomplete feature
branch I already committed a Fix
for master
.
(master) A-B-C
(feature) \_D-E-Fix-G-H
How do I get the Fix
commit onto master
, ...
(master) A-B-C------Fix'
(feature) \_D-E-Fix-G-H
... but still being able to merge/rebase my feature
branch on master
?
(master) A-B-C-D-E-Fix-G-H
I suppose Fix'
should maintain the same SHA of Fix
in order to not be seen a total different commit and be merged/rebased smoothly (so cherry-pick
, that I usually use, is not helpful here).
So maybe it is not possible, but I am curious if there is any way to share some temporary fixes from a branch with another branch, and still be able to merge later the rest of the missing commits.
My feature
branch is just a local one. Naturally I want to avoid rewriting the history.
If the
Fix
commit is cherry-pickable, then it's independent ofD
andE
, so you couldgit rebase -i C
and reorder your history to putFix
behindD
.Then it would be easy to merge the feature branch back into master.
You mentioned you wanted to avoid rewriting history, but if you are okay with picking out a single fix commit, I think reordering your feature branch to make it more easily mergable should be acceptable.