In a repo, I have the main master
branch that the team uses. I have developed a new feature on another branch called feature
. I then merged this feature
branch with master
using:
git checkout master
git merge feature
However, I forgot to squash the commits from the feature branch. There were 81 commits on that branch, and now I can see all of those in master
. I want to undo this merge, and redo it with the --squash
argument so that all of these 81 commits are squashed into one. How can I do this? There are a bunch of answers on undoing merges (but revert
is not useful in my case because it doesn't remove the 81 commits from the commit history, it just adds a new commit reverting the changes) and I wasn't sure a hard reset to the previous commit id would erase all of these commits from the master
commit history.