Git Revert Multiple Commits

Last modified: 
Monday, February 8th, 2016
Topics: 
Git

Problem

You have multiple git commits to revert, but you don't want to record a commit message for each of these reversions. In other words, you want revert commits 123, 456, and 101112 but group the changes into a single commit message.

Solution

Use the --no-commit flag.

git revert --no-commit 123
git revert --no-commit 456
git revert --no-commit 101112
git commit -m 'All three reversions are stored as a single commit.'

References


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.