I'm trying to append a string to the end of a Git commit message and this SO post was a very helpful step in the right direction.
So far, this is working in .git/hooks/prepare-commit-msg but appending my string on a new line:
echo "foo" >> "$1"
with output:
"Initial commit
foo"
I was looking into how to append on the same line with echo
but I'm unable to successfully pass the -n
argument to echo in a commit hook. In addition to echo
, I also tried printf
to no avail as well.
I'm looking to have the my commit message look like:
"Initial commit foo"
Does anyone have any idea on how to accomplish this?