I am using the Git Flow way of managing branches in my repository.
Thus the sequence of commands I should use would be as follows:
git checkout mybranch
git pull --rebase origin develop
git checkout develop
git merge --no-ff mybranch
However, there is one thing that I would like to do differently, in some cases:
I would like to preserve all of my commits on my feature branch (mybranch
), but have them squashed into a single commit when merging into develop
.
So this is what I think the sequence of commands should be:
git checkout mybranch
git pull --rebase origin develop
git checkout develop
git merge --no-ff --squash mybranch
Would I be doing things wrong if I were to combine --no-ff
with --squash
?
I am hesitant to try this out because "squashing" and "preserving history" are orthogonal requirements (see this answer).
My rationale is that I want to preserve history on one branch (mybranch
) and squash on another branch (develop
) --> because these actions are performed in separate branches, this is OK.
reset
if it doesn't work. Just make a temporary branch at the old spot. Go on. Try it. You know you want to... – Onstage