SVN re-education
I guess it is a bad habit from svn, which has a default to add only tracked files [...]
You must unlearn what you have learned :)
You should run git status
often. If files you want to ignore get listed as untracked files, you should then edit your .gitignore
file, so that those files actually become ignored. Because git add
doesn't affect ignored (and untracked) files, you will then be able to use git add .
to stage all files of interest (and only those) in one fell swoop.
How to completely disable git add .
Git itself doesn't allow to do that, but if you really want to completely forbid the use of git add .
(and git stage .
, an exact equivalent), you can write a small wrapper around git
(in your ~/.<shell>rc
file) for that:
git() {
if [ "$1" = "add" -o "$1" = "stage" ]; then
if [ "$2" = "." ]; then
printf "'git %s .' is currently disabled by your Git wrapper.
" "$1";
else
command git "$@";
fi
else
command git "$@";
fi;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…