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

Re: Keep original author with git merge --squash?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 12, 2015, 22:34 UTC
Message-ID
<xmqq4mqqrc70.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAN7QDoJ+hOFqoc54sAbLeSxvj8TQKQRSVKbNQXZYfPv1uOy=WA@mail.gmail.com>
David Glasser <glasser@davidglasser.net> writes:
Show 14 quoted lines
> So to be concrete: What I'm proposing (and I'm excited to implement
> it!) is the following:
>
> When running "git commit" and:
> - You've fallen into the case where the message was read from SQUASH_MSG
> - You haven't used another method of specifying the author (--author,
>   -C, -c, --amend)
> - You have not specified --reset-author
> - You have set the "commit.useSquashAuthor" option
> - Before invoking prepare-commit-msg, all of the `Author:` lines found
>   in SQUASH_MSG have the same value
>
> then that author is used, as if it were specified with --author.  (And
> this will show up, commented-out, at the bottom of COMMIT_EDITMSG.)

I actually was hoping that this would extend to cases other than "git merge --squash".

When running "git commit" and:
 - You didn't use a more explicit method of specifying the
   authorship identity (--author, --date, -C, -c --amend,
   --reset-author options, or environment variables GIT_AUTHOR_*);
 - You have commit.useAuthorFromEditorComment variable;
 - You have "# Author: " line that are identical in the result of
   the editor,

then use that author. That would allow "git commit --amend" to update a misspelled author name, for example.

Is that a bit too liberal?  Would it invite mistakes?
Previous: David GlasserNext: Jeff King
Message 11 of 18 in “Keep original author with git merge --squash?”
  1. David GlasserFeb 11, 2015
  2. Jeff KingFeb 12, 2015
  3. Michael HaggertyFeb 12, 2015
  4. Jeff KingFeb 12, 2015
  5. David GlasserFeb 12, 2015
  6. Junio C HamanoFeb 12, 2015
  7. David GlasserFeb 12, 2015
  8. Junio C HamanoFeb 12, 2015
  9. David GlasserFeb 12, 2015
  10. David GlasserFeb 12, 2015
  11. Junio C HamanoFeb 12, 2015
  12. Jeff KingFeb 12, 2015
  13. Junio C HamanoFeb 12, 2015
  14. Jeff KingFeb 13, 2015
  15. Junio C HamanoFeb 13, 2015
  16. Jeff KingFeb 13, 2015
  17. David GlasserFeb 13, 2015
  18. David GlasserFeb 13, 2015

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.