2

When reverting multiple commits using

git revert -n f0000000
git revert -n baaaaaaa

is it possible to ask git to mention in the new commit message all the commits you've reverted, not just one of the commits?

I'm on git version 1.6.3.3, so apologies if it's been fixed in more recent versions.

Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338

1 Answers1

3

As far as I know, git creates a new commit message with each revert and hence you will not be able to preserve them all together.

One suggestion is that, if the commits are together, you can squash them first, and then revert, thereby getting all the commit messages.

Edit:

Another alternative, if you can call it that:

git revert -n <sha1>
cp .git/MERGE_MSG .git/MERGE_MSG_1
git revert -n <sha2>
cat .git/MERGE_MSG_1 >> .git/MERGE_MSG
git commit
manojlds
  • 290,304
  • 63
  • 469
  • 417