Skip to content

Instantly share code, notes, and snippets.

@bitmage
Last active January 21, 2021 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitmage/20243dcc8e73232547126e253f6a6e00 to your computer and use it in GitHub Desktop.
Save bitmage/20243dcc8e73232547126e253f6a6e00 to your computer and use it in GitHub Desktop.
git status recursively
#!/bin/bash
shopt -s globstar
for repo in ./**/.git; do
dir=`dirname "$repo"`
printf "$dir:\n"
export GIT_DIR="$repo"
export GIT_WORK_TREE="$dir"
git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
git status --short
done
@bitmage
Copy link
Author

bitmage commented Jan 21, 2021

Current usecase: I'm reinstalling my OS and want to know what errant git repos I should sync before nuking it.

@bitmage
Copy link
Author

bitmage commented Jan 21, 2021

Updated version uses globstar instead of find. Works with file names containing spaces.

@bitmage
Copy link
Author

bitmage commented Jan 21, 2021

Updated version uses globstar instead of find. Works with file names containing spaces.

@bitmage
Copy link
Author

bitmage commented Jan 21, 2021

Now also prints out status of whether the repo has been pushed.

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