所以我有一个sh脚本,它将一些文件放在一起,然后将它们提交到git repo中。如何动态地将日期添加到提交消息中?
我的.sh看起来像
// do things to files...
git add -u;
git commit -m 'generated files on <date here?>';
git push origin master;
最佳答案
只需格式化date命令的输出,鲍勃就是你的叔叔:
// do things to files...
git add -u;
git commit -m "generated files on `date +'%Y-%m-%d %H:%M:%S'`";
git push origin master