Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jarek-przygodzki/d1c8588ed6f94f7ad194e12fe5f981a8 to your computer and use it in GitHub Desktop.
Save jarek-przygodzki/d1c8588ed6f94f7ad194e12fe5f981a8 to your computer and use it in GitHub Desktop.
Benchmark results of the fastest way to check if a git branch is dirty

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment