开发者

Informative message for reverting multiple git commits

开发者 https://www.devze.com 2023-04-05 20:08 出处:网络
When revert开发者_开发百科ing multiple commits using git revert -n f0000000 git revert -n baaaaaaa

When revert开发者_开发百科ing 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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消