53

For example, this commit is claimed to be authored by mattcaswell and committed by richsalz

enter image description here

What usage flow could have caused this? Suppose I want a commit which is authored by someone else and committed by me to appear in a repo where I'm a contributor - how would I have that?

sharptooth
  • 167,383
  • 100
  • 513
  • 979

2 Answers2

51

Git distinguishes between authors and committers (see Difference between author and committer in Git?). Authors are the people who wrote a specific piece of code - committers are the people who put these changes into the git "history".

Normally both are the same (and doesn't change on merging, cloning, pushing or pulling).

Causing the two to point to different people can happen on rebasing, editing a commit (e.g. amending), doing a commit on behalf of someone else (e.g. by specifying --author), applying patches (git am), squashing (e.g., on merge or rebase), or cherry-picking.

MrTux
  • 32,350
  • 30
  • 109
  • 146
12

Since March 2019 (5 years after the OP's question), there is another scenario where a commit authored by one person, and committed by another, especially in the context of the organization github.com/openssl used in the question.

Creating a commit on behalf of an organization

Developers can indicate their intent to contribute to a project on behalf of an organization.
This can help minimize confusion over ownership, for example, when contributing to a third-party project on behalf of your employer.

For a given commit to be associated with an organization:

  • The committer must add an On-behalf-of commit trailer to the commit, in the form of: On-behalf-of: @ORG <ORG CONTACT EMAIL>,
  • The committer must be a member of the organization,
  • The commit must be committed with an email in the organization’s verified domain, and
  • The commit must be signed.

Support for the On-behalf-of commit trailer is currently in public beta.
For more information, see creating a commit on behalf of an organization.

https://help.github.com/assets/images/help/repository/write-commit-message-on-behalf-of-trailer.png

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250