Reverting a Range of Git Commits Separately

3 Jul 2012

All kinds of articles on the Internet tell you how to revert a range of git commits in one massive, squashed-together revert commit. But to split them up into separate revert commits you have to pass a list of commits to git revert, and that list has to go in reverse order to avoid conflicts.

git rev-list --reverse ${last_good_commit}.. | xargs git revert