How can I stop using 'git commit -a'?
I confess that sometimes I use git commit -a
when I shouldn't. It was getting a reflex about half the time, often when I think I am working in separate repositories, but I am actually working in a lot more that will affect directories far and wide.
Is it possible to specify a parameter .git/config
that will cause the error -a
to trigger the error?
source to share
Is there a .git / config parameter I can specify that will result in the -a error for the error?
Not that I know.
You will need a git wrapper that will check the arguments (" commit
", " -a
", ...), and on a specific command, "commit -a" will throw an error.
The Jubobs ' script (mentioned in the comment above ) is a good example of such a shell.
source to share
No, there is nothing in the git config that will do this. However there is a solution and git is hooks.
Git hooks are scripts that are executed before or after a git command is executed - for example, there is a hook that doesn't remove your commit if there is no commit message. So you can write a costum hook for your needs, which falls when the commit is sloppy.
However, personally I would not mind, but rather show an additional hint (for example, "Are you sure?" Y / N). Think about it, do you really want to block functionality forever?
More information: http://git-scm.com/book/en/Customizing-Git-Git-Hooks
Good luck!
source to share