Skip to content

Instantly share code, notes, and snippets.

@eduncan911
Last active March 3, 2016 03:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eduncan911/e325fc05b891691999be to your computer and use it in GitHub Desktop.
Save eduncan911/e325fc05b891691999be to your computer and use it in GitHub Desktop.
Git Pending Repos
# add this code to your .bashrc file
# gitpending() transverses from the current directory to
# inspect 1 directory level deep for any git repos that have
# pending changes to commit.
function gitpending()
{
for d in */ ; do
pushd $d > /dev/null
DIRNAME=$(basename "$d")
if ! git diff-index --quiet HEAD --; then
echo $DIRNAME
fi
popd > /dev/null
done
}
# example usage:
#
# ~/$ cd go/src/github.com/eduncan911
# ~/go/src/github.com/eduncan911$ gitpending
# eduncan911.github.io
# go-mspec
# go
# ~/go/src/github.com/eduncan911$
#
# the above example looked at all directories I had
# under ~/go/src/github.com/eduncan911 to find 3
# directories with pending changes:
#
# eduncan911.github.io
# go-mspec
# go
#
# (i currently have 11 repos in that directory; so
# in other words, it found 3 with pending changes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment