Skip to content

Instantly share code, notes, and snippets.

@nk9
Forked from ctindall/git-show-all-objects.sh
Last active August 29, 2015 14:02
Show Gist options
  • Save nk9/d51c452b4ebe7a9b974b to your computer and use it in GitHub Desktop.
Save nk9/d51c452b4ebe7a9b974b to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
cd "$(git rev-parse --show-cdup)"
# Find all the objects that are in packs:
if [ "$(ls -A .git/objects/pack)" ]
then
for p in .git/objects/pack/pack-*.idx
do
git show-index < $p | cut -f 2 -d ' '
done
fi
# And now find all loose objects:
find .git/objects | egrep '[0-9a-f]{38}$' | awk -F '/' '{print $3$4}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment