Last Updated: February 25, 2016
·
2.275K
· charlisim

Append actual date and time to git commit message

If you want to append the actual date to all your repository commits you have to create or modify the following file.

.git/hooks/commit-msg

If you want an skeleton file you can copy the sample message with this command

cp .git/hooks/commit-msg.sample .git/hooks/commit-msg

In that file you have to add the following line

echo "`date`" >> $1

2 Responses
Add your response

But why? When you call git log <sha> you will get the date and time of commit.

over 1 year ago ·

I use it because I have a git repository in a USB device for all my classroom notes and exercises, and I want to know when I did the commit in a faster way.

over 1 year ago ·