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

Re: [PATCH v2] commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 5, 2009, 05:40 UTC
Message-ID
<7vws25a5s2.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20091105123456.6117@nanako3.lavabit.com>
Nanako Shiraishi <nanako3@lavabit.com> writes:
Show 27 quoted lines
> It may be wise to forbid a combination of options if it 
> encourages mistakes or a wrong workflow, but I don't think 
> using --author and --reset-author with 'git commit --amend' 
> is such a case.
>
> Imagine somebody other than you (eg. me) were the maintainer, 
> and a message by Szeder was sent with a good commit log message.
>
>  http://article.gmane.org/gmane.comp.version-control.git/132029
>
> Then you sent a replacement patch that solves the same problem 
> in a more elegant way, but without anything that is usable as the 
> commit log message.
>
>  http://article.gmane.org/gmane.comp.version-control.git/132041
>
> If I were the maintainer, I would find it very convenient if I can 
> work like this:
>
>  % git am -s 132029   --- first I apply Szeder's version
>
> Then I see your message. Replace the code change but use Szeder's
> log message.
>
>  % git reset --hard HEAD^
>  % git am 132041   --- your version with no usable log message
>  % git commit --amend -s -c @{2} --author='Junio C Hamano <...>'
Thanks.

So you commit Szeder's and then commit mine (make them independent), and amend the log message of the latter using the message from the former, and assign the authorship of the latter to the resulting commit?

That is a much more understandable argument than just claiming "--author should be usable with --reset-author" without clearly stating why that would help. I think you forgot to add --reset-author to the last command line, though.

But I think it is showing that --reset-author is actually suboptimal way to solve your scenario. In the last command in your sequence, you don't want to add "--reset-author --author=X" but want "--reuse-only-message" option.

And I think it makes much more sense than the alternative semantics we came up with during this discussion. --mine (or --reset-author) to declare that "I am the author" was not what we wanted after all(yes, I am guilty for suggesting it). What we want is "I am using -C/-c/--amend and I want to borrow only the message part from the named commit (obviously "amend" names the HEAD commit implicitly). Determine the authorship information (including author timestamp) as if I didn't use that option."

Previous: Nanako ShiraishiNext: Erick Mattos
Message 5 of 6 in “commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-author”
  1. commit -c/-C/--amend: reset timestamp and authorship to committer with --reset-authorErick Mattos, Nov 4, 2009
  2. Junio C HamanoNov 4, 2009
  3. Erick MattosNov 4, 2009
  4. Nanako ShiraishiNov 5, 2009
  5. Junio C HamanoNov 5, 2009
  6. Erick MattosNov 5, 2009

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.