Revert Git commit

To revert the last n commits using git:

git revert HEAD~3..HEAD;

Where HEAD~3 resolves to the 3rd most recent commit, HEAD resolves to the most recent commit, and .. between the two fills in every commit in between.

You can also add --no-commit to stage it all as one commit.

#til, #code