Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unknown switch 'm' with git alias to commit

In my .gitconfig, I have the following alias:

c = add -A && git commit -m

The idea is to add all changes and commit them. However, I'm not getting success with this because Git is giving me the message error: unknown switch 'm'.

like image 431
Enrico P. Varella Avatar asked Jun 18 '26 04:06

Enrico P. Varella


1 Answers

Bad idea. git add or even better git add -p is a great opportunity to review what you did once again before committing.

Anyway, to execute your git alias in a shell you need to use this syntax:

c = !git add -A && git commit -m

Or you could just use git commit -a which seems to be what you want. This will not automatically commit new files but do you really want to commit every single untracked file? Remember that you might have temporary stuff around which is not on gitignore. While it would be easy to undo/amend a commit that accidentally adds this kind of crap, it's better not to commit it in the first place!

like image 87
ThiefMaster Avatar answered Jun 20 '26 22:06

ThiefMaster