Technically all arguments to shell scripts are optional. It's up to the script to determine if there are missing arguments and what to do about it. This can be done in several ways depending on your needs. For a script that has only one argument which is optional, something like this would work:
#!/usr/bin/env sh if [ ${#1} -eq 0 ] then git commit -m "default message" else git commit -m "$1" fi
This checks if the length of the first argument is zero and acts accordingly. If the first argument is missing, it counts as having zero length. You could also check against number of arguments by comparing against $#
.
A shorter variation of the above script, which takes advantage of empty argument substitution, is:
#!/usr/bin/env sh git commit -m "$"
This sort of thing is described here under "2.6.2 Parameter Expansion".