git config - Is it possible to disable a "dangerous" command line option in git? -



git config - Is it possible to disable a "dangerous" command line option in git? -

by habit, i'll work on alter in repo, , add/commit in 1 shot using git commit -am 'my commit message'

there times when want add together few of modified files, i'll issue preparatory git add commands meticulously set-up staging area, , separate ready-to-commit changes half-baked changes.

then, i'll fat-finger whole thing issuing same git commit -am '...' command do.

would there way me disable git commit -a option, and/or issue warning when utilize -a switch? want train myself out of sketchy habit...

create wrapper script named git grab bad commands , forwards ones on real git. set before in $path:

#!/bin/bash arg in "${@}"; if [ "${arg}" = "-am" ]; echo "hey! don’t that!" 1>&2 exit 1 fi done exec /usr/bin/git "${@}"

almost git commands work fine:

$ git pull remote: counting objects: 1183, done. remote: compressing objects: 100% (728/728), done. remote: total 1183 (delta 771), reused 632 (delta 455) receiving objects: 100% (1183/1183), 1.12 mib | 1.46 mib/s, done. ...

but ones don’t want work won’t:

$ git commit -am "foo" hey! don’t that!

git git-config

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -