I'm running this shell script whenever I do a git commit -m "msg"
which writes the commit log to a php file. I want it to include the current commit message as well that I am doing at that time.
My shell script:
#!/bin/sh
path="path/to/gitlog.php"
echo "<?php $git_log = array(" > $path
git log --date=iso --pretty=format:'array("%h","%an","%ad","%s"),' >> $path
echo ");" >> $path
The gitlog.php gets saved to my repository, which I will then git push
.
I currently have it in 'pre-commit' hook, is there a way to get the committing message within this hook?
My use case
I am the only developer in the project. Time is short! it's for others who are involved in the project to see progress and read the descriptive commit logs without the overhead of me having to double up. The log is output to a dashboard that everyone has access to.
Git is not running on the dashboard server, and files are deployed from a repository hosting company (Beanstalk)
Another option could be to create an appropriate hook that writes the changelog to a file outside your repo, and then pushes the file to somewhere accessible by external users. No need to commit the changelog then, which is the cause of problems.
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