Shell script helper for git commits
You must quote the variable in your script.
#!/bin/bash -ecommit_message="$1"git add . -Agit commit -m "$commit_message"git push
I also set "-e" so that if there are any errors, the script will exit without processing subsequent commands.
As to your second question, the .
in the script should refer to your current working directory, as you intend. However the -A
is causing it to add all files that have been modiied in the repo.
You can create alias with argument. Something like:
[alias] cap = "!git add . && git commit -m '$1' && git push origin"