Git Developer Guide
How to find all Git repos with uncommitted changes on Mac
The Command Line Solution
To find every Git repository with uncommitted, modified, deleted, or untracked files from the terminal, you can combine find with git status --porcelain:
# Search inside ~/Projects
find ~/Projects -name .git -type d -prune | while read -r gitdir; do
repo=$(dirname "$gitdir")
if [ -n "$(git -C "$repo" status --porcelain 2>/dev/null)" ]; then
echo "Dirty: $repo"
git -C "$repo" status -s
fi
done
Why this is slow on macOS
On macOS, process creation via posix_spawn or fork is relatively heavy compared to Linux. Running find and invoking a subprocess for every repository:
- Takes 10–30 seconds if you have more than 30 repositories.
- Traverses deeply into nested build directories like
node_modules,.build, ortargetunless explicitly excluded. - Requires you to manually open terminal windows for each dirty repo.
The easier way: GitMon
GitMon parses the binary .git/index stat cache directly in Swift, honours your .gitignore, and also compares the index against HEAD so git added work still counts as dirty. About 10 ms per repository, with nothing polling in the background.