I am using the git flow way of managing branches in my repo, as described in: http://nvie.com/posts/a-successful-git-branching-model/
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 lumped together (or squashed) into a single diff 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 stems from how "squashing" and "preserving history" are orthogonal requirements - see Squashing all of my commits (including merges) into one commit without altering history
My rationale is that I want to preserve history on one branch (mybranch
) and suqash on another branch (develop
) --> because these actions are performed in separate branches, this is OK.