如何将当前日期设置为git commit消息

时间:2011-01-11 05:14:43

标签: git bash

如何将当前日期设置为git commit message?

2 个答案:

答案 0 :(得分:28)

git commit -m "`date`" filename

答案 1 :(得分:0)

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