git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git revert --reference doesn't populate commit subject

From
Bagas Sanjaya <bagasdotme@gmail.com>
Date
Oct 18, 2022, 03:02 UTC
Message-ID
<Y04XTl6yWXZv6xk5@debian.me>
Hi,

When reverting commit with `git revert`, the subject for revert commit is populated ("Revert <original commit subject>"). However, when reverting with `git revert --reference`, the subject doesn't get populated; only commit message is generated ("This reverts <original commit reference>..."). When no subject is given, the first paragraph of the message automatically becomes commit subject.

To reproduce:
```
$ mkdir /tmp/test && cd /tmp/test
$ git init && git branch -m main
$ echo "test" > test
$ git add test && git commit -m "test"
$ echo "whoops" > test
$ git commit -a -m "whoops"
$ git revert HEAD
// keep the commit message by just exiting the editor
$ git log -n 1 --pretty="format:%s" -p HEAD
  Revert "whoops"
$ echo "whoops" > test
$ git commit -a -m "whoops again"
$ git revert --reference HEAD
// keep the commit message by just exiting the editor
$ git log -n 1 --pretty="format:%s" -p HEAD
  This reverts <reference to "whoops again" commit>.
```

In the reproducer above, I expect that the second revert generates `Revert "whoops again"` subject.

Thanks.
-- 
An old man doll... just what I always wanted! - Clara
Message 1 of 1 in “git revert --reference doesn't populate commit subject”
  1. Bagas SanjayaOct 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.