I have a custom Git hook in prepare-commit-msg
that appends the date to the commit message so I don’t have to input it myself:
#!/bin/bash
#
# Append current `date` to commit messages
echo "`date +'%Y-%m-%d'`" >> $1
When I commit in my local repository, the date is appropriately appended to the Git commit message. However, when I push to GitHub, the commit message appears without the date appended. Why?
When committing, I ran the following command in Git Bash:
git commit -S -m "Refresh data" && git push
Is the intended message not appearing in GitHub because I combined git commit and git push in the same command perhaps? (I haven’t had a chance to try entering separate commands yet.)
(Aside: I realise git commits include a timestamp that contain the date. I want to insert the date for the sake of convenience. The point of this question is not to discuss the text being appended.)
tumbling_tower is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.