Assume you want to undo a dozen of commits and you want only some of them.
git rebase -i <earlier SHA>
-i puts rebase in "interactive mode". It starts off like the rebase discussed above, but before replaying any commits, it pauses and allows you to gently modify each commit as it's replayed.
rebase -i will open in your default text editor, with a list of commits being applied, like this:
To drop a commit, just delete that line in your editor. If you no longer want the bad commits in your project, you can delete lines 1 and 3-4 above.If you want to combine two commits together, you can use the