In order to make uploading the code to github easily, I created a sh script
#commit.sh
git add .
git commit -m $1
git push origin master
But when I run it by saying ./commit.sh "comment1 comment2 comment3"
, I get the error of:
error: pathspec 'comment2' did not match any file(s) known to git.
error: pathspec 'comment3' did not match any file(s) known to git.
What's wrong and how do I make it work?
Always quote your variables! Change it to
and then
will work.
You could combine several commands in one line.
which is a nice line to use as a command:
If you place that command in your
.bash_aliases
file, you can use it as follows:This command will work when every step of it works.