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'.
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!
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