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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.