Git - Author

About

The author is the person who originally wrote the code or the patch.

The author date is also referred to as the commit date.

Default

The default author in git is in order of precedence:

  • the global user
git config --global user.name "Your Name"
git config --global user.email [email protected]
  • the environment variable EMAIL,
  • the system user name and the hostname used for outgoing mail (/etc/mailname)
  • the fully qualified hostname

How to define the author in a commit?

Git - Commit

git commit --author="Name <email>" -m "whatever"
# modification of the last commit, -C HEAD to not modify the message
git commit --amend --author='Name <email>' -C HEAD

Note that author information is taken from the following environment variables, if set:

GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE

How to set the author date?

# Give a date to the commit
git commit --date='Wed Feb 16 14:00 2037 +0100'
git commit --date='2005-04-07T22:13:13' # Iso

# Change the date of a previous commit
# The -C HEAD is just to bypass editing the commit message
git commit --amend --date='Wed Feb 16 14:00 2037 +0100' -C HEAD

1)

Multiple authors are not supported

Not supported: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=451880





Discover More
Git Commit Tree Data Model
Git - Commit

A commit in git is an object that stores the information : who saved the file system snapshots, when they were saved, why they were saved. the commiter the author the parent commit It's...
Git - Committer

The committer is the person who committed the code or applied the patch on behalf of the original author. It's generally a project maintainer or core member. The default Committer is the OS user. ...
Git - User

The user originally for Git is the author. But Git knows two persons: the author: the person who originally wrote the code / the patch. the committer: the person (project maintainer or core member)...



Share this page:
Follow us:
Task Runner