I wanted to edit a commit message that was already merged into the master branch (which is a protected branch).
To do that, I created a new branch from a master branch and used interactive git rebase(i.e. git rebase -i HEAD~2), rewrite the commit message and pushed the new branch. but when I checked the commits in my branch, it included 6 commits, 2 were same as those listed in editor but the other 4 were all the commits from the last squashed merged request. so the master commit history looks like this:
- Merge branch aaa into master
- commit with wrong message (that I wanted to edit) (went into master from branch aaa)
- Merge branch bbb into master
These 4 commits I see are all the commits in branch bbb that are squashed into one merge commit. Any idea why this happened? Is it because of what is called linearizing the history rather than preserving the merge? but when I selected to go back 2 HEAD, how it included the 3rd commit (Merge branch bbb into master) from master branch