How to set current date as git commit message?
3 Answers
git commit -m "`date`" filename
-
5and if you want to format the date:
date +\"%Y-%m-%d\"
(in Windows, ymmv)– drzausSep 5, 2014 at 14:12 -
4@KushalJayswal it does work with Git Bash on Windows 10. Just make sure you put the quotes properly:
git commit -m "`date +\"%Y-%m-%d\"`"
– F1iXFeb 18, 2019 at 9:44
git commit -m "`date`" # Wed Aug 28 10:22:06 CST 2019
git commit -m "`date +'%Y-%m-%d'`" # 2019-08-28
git commit -m "Updated: `date +'%Y-%m-%d %H:%M:%S'`" # Updated: 2019-08-28 10:22:06
current="`date +'%Y-%m-%d %H:%M:%S'`"
msg="Updated: $current"
git commit -m "$msg" # Updated: 2019-08-28 10:22:06
git today
=git checkout -b w-${1-``date +\"%Y-%m-%d\"``}
) (double backticks should be single, boo markdown)