I am trying to add alias for a default commit message, something like this:
alias gc='git commit -m "Default commit: $(date)"'
but I don't like date's default format and would like to change it to this:
date +'%A, %d %B %Y %H:%M:%S' # Tuesday, 02 May 2017 23:12:07
I run into problem of how to build this in alias. I cannot handle the multiple double and single quotes. Can someone help?
Edit.
Thanks for the suggestion on using function and the code. Based on that I have made this, slightly changed:
gc ()
{
if [ "$#" == "0" ]; then
itsmsg="Deafult commit";
else
itsmsg="$*";
fi;
git commit -m "$itsmsg ($(date +'%A, %d %B %Y %H:%M:%S'))"
}