I have two branches, master
and feature
. I want to merge feature
into master
, but I have multiple changes in the feature
branch with messy commits. I don't want to squash these messy commits in the feature
branch but I want to squash them when I merged the feature
branch into master
. One way is using the following command in master
:
git merge --squash feature
But the above command will squash all commits and will create a single commit which is not desired. I want to squash some commits, not all of them. For example, I want to squash 3 out of 10, but only while merging into master
.
What should I do?