Skip to content

Instantly share code, notes, and snippets.

@aklinkert
Last active July 19, 2022 08:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aklinkert/ed2f33d7249442032312334c6f29726e to your computer and use it in GitHub Desktop.
Save aklinkert/ed2f33d7249442032312334c6f29726e to your computer and use it in GitHub Desktop.
Bash script to recursively check uncommitted changes in a directory tree.
#!/usr/bin/env bash
cwd="$(pwd)"
find . -print0 -type d | while IFS= read -r -d '' file; do
if [ ! -d "${file}/.git" ]; then
continue
fi
cd "${file}"
if [[ -n $(git status -s) ]]; then
echo "Repo ${file} has modified/untracked changes"
fi
cd "${cwd}"
done
@bulwinkel
Copy link

This is gold, thank you!

Copy link

ghost commented Sep 30, 2021

Thanks a lot. This saved my day.

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