Tested against the WebKit git repo by entering the repo with 1 file dirty.
git diff --quiet --ignore-submodules HEAD
# Will tell if there are any uncomitted changes, staged or not.
0.6 sec
git diff-index --quiet HEAD
# Only tracked
2 sec
git diff --shortstat
8.2 sec
git status --porcelain
42 sec
zstyle ':vcs_info:*' check-for-changes true
50 sec
@sindresorhus Doesn’t
git status
without--porcelain
do it too, kind of? That’s what I am using at the moment in my dotfiles: https://github.com/mathiasbynens/dotfiles/blob/9aecb166d67e0119472aceb8bba71b06256929d8/.bash_prompt#L46-L48 (credit to that code goes to @gf3; I stole it from him)It might be slow, though.