I'm creating a bash script that updates a git branch, everything works fine but now i want to add the option to specify the commit message as a parameter.
I used this command first:
echo "Executing git commit..."
git commit -m "$1"
but when i sent something like this:
$ git.sh "testing commit message"
I get a bunch of errors telling me the command cannot be recognized by git.
I suppose in this case that the double quotes I added are not passing the parameter as a single string but as many, so only the first one is taken by the -m option and git tries to pass the others as commit options.
Is there a better way i can pass a multi word string as git commit message when getting it from the script arguments?
I would really appreciate any suggestion you have.
echo xxxx"$1"XXXXbefore the call to git. Good luck.