Created
June 20, 2020 13:21
-
-
Save beyondlimits/413526d008a92ba3fba73c9f0204e8a3 to your computer and use it in GitHub Desktop.
List all objects in Git repository. Taken from https://stackoverflow.com/questions/7348698/git-how-to-list-all-objects-in-the-database/38083908#38083908
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
shopt -s nullglob extglob | |
cd "`git rev-parse --git-path objects`" | |
# packed objects | |
for p in pack/pack-*([0-9a-f]).idx ; do | |
git show-index < $p | cut -f 2 -d ' ' | |
done | |
# loose objects | |
for o in [0-9a-f][0-9a-f]/*([0-9a-f]) ; do | |
echo ${o/\/} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment