I wish to write a simple git script that will run the following lines:
cd <the name of my git repo>
git add *
git add -u
git commit -m "<my comment in the form of a string>"
git push origin master
I’m new to bash scripting, so this has been a bit of a problem for me. My existing attempt is as follows:
#!/bin/sh
cd <my repo name which has no have any spaces>
git add *
git add -u
git commit -m $*
git push origin master
I don’t quite know how to throw in a proper string argument surrounded by quotes. I currently try to run the program like this:
autogit.sh "Example comment."
How do I have to change my script so it works with multi-word commit comments?
The quickest answer here is that in your script, the commit line should read
git commit -m "$*"