so I have an sh script that throws together some files then commits them to a git repo. How can I dynamically add the date to my commit message?
My .sh looks something like
// do things to files...
git add -u;
git commit -m 'generated files on <date here?>';
git push origin master;
Just format the output of the date command and Bob's your uncle:
// do things to files...
git add -u;
git commit -m "generated files on `date +'%Y-%m-%d %H:%M:%S'`";
git push origin master
Why not use prepare-commit-msg
or commit-msg
git hooks? You can find stubs in your .git/hooks
directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With