In git, I usually prefer to not use the staging area very much, and just work with my working tree. Call me crazy, but I don’t get much use out of this extra step before committing, etc., of adding all the files to a staging area, then running git commit
.
So whenever I want to create a new commit, I run git add -A && git commit ...
But git add -A
is so slow! On my repo, it’s taking 5-10 seconds to run!
I’ve noticed that git status
is much faster – usually less than 1 second.
-
Why is
git add -A
so much slower? Since a regulargit add
is pretty fast, I always assumed what makesgit add -A
so slow is enumerating all the untracked files. Butgit status
also has to do that, and it’s fast. -
Can I get the same effect as
git add -A
, but faster, by runninggit status
and piping the output togit add
? Something like (this won’t be totally correct):git status -s | cut -d ' ' -f 2 | git add
. Is there something else thatgit add -A
is doing that I’m missing, and I’d have problems going this route?