Can git commit -a -m "commit msg"
be shortened to git commit -am "commit msg"
and work as expected?
Basically, can options be given as "short" switches and let the last switch accept an argument?
Yes.
Well-written Unix commands let you coalesce multiple single-letter options behind a single hyphen, as long as none of the options except the last one in the group can take an argument. Git is one of these well-written commands.
Many people who haven't spent much time in the Unix shell don't realize this, and unfortunately, sometimes those people end up writing command-line utilities that don't use the standard getopt(3)
to parse their options, and end up writing their own parser that doesn't allow you to coalesce options in the standard way like this. So there are some poorly-written commands that don't allow that. Luckily, git is not one of those poorly-written commands.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With