How to run git rebase interactive mode to remove duplicate commits
Give git rebase the number of commits back in time. For 10 commit back in history:
git rebase -i HEAD~10
Then simply delete the lines for the commits you want to remove in the text editor that is shown. Saving the file and exiting will start the rebase and the lines that were removed will no longer be in the history once the rebase has completed.