Git - Author
About
The author is the person who originally wrote the code or the patch that is commited
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 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
How to define the author in a 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
Multiple authors are not supported
Not supported: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=451880