I had a feature branch and a PR on github. This branch had many commits. I eventually merged the PR into master (did not squash all my commits into 1, so theres still ~50 commits that got put into master's history).
I'd like to undo that merge completely (along with all the commits that came from my feature branch along with the merge). I know I can do git reset --hard <sha before merge>
but would that also remove all the commits that came into master from my feature branch as a result of the PR merge?
CodePudding user response:
looks like github has a 'revert' button on the merged PR - it will create a new PR to undo all the changes. I will go with that option. thanks all
CodePudding user response:
You can use git rebase -i HEAD~<number of commits>
then squash all the commits into one. But the catch here, you have to force push the master branch.
It's always the best practice to squash all commits and rebasing with latest master of the branch you are merging before merging that into master. Cheers!