Reputation: 1778
Trying to prepare simple shell commit script for git, like
git add .
git commit -m $@
git push origin master
to run it in ./script.sh 'commit message' manner
I ran into issue with commit messages containing space. I understand I need to wrap $@ in quotes on string 2, but all my tries have failed so far(I tried straight ', then \', then fancy '\'' I found while researching, still no luck). Please help!
Upvotes: 0
Views: 93
Reputation: 780974
If you're running the script as:
./script.sh 'commit message'
then the commit message is just $1
, and your script should contain:
git commit -m "$1"
Upvotes: 1