Skip to content

Instantly share code, notes, and snippets.

@n8gray
Created September 19, 2016 19:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8gray/233f728f6b42c94ad6c28cb55044749f to your computer and use it in GitHub Desktop.
Save n8gray/233f728f6b42c94ad6c28cb55044749f to your computer and use it in GitHub Desktop.
Shows a list of submodules that exist at the given commit, along with their corresponding submodule commits.
#!/bin/sh
if [[ $# != 1 ]]; then
echo "usage: $0 SHA"
echo " Shows a list of submodules that exist at the given commit, along with their corresponding"
echo " submodule commits."
exit 1
else
SHA=$1
fi
# Look through the entire tree of the commit and filter out submodules by permission bits
git ls-tree --full-tree -r $SHA | grep '^160000' | cut -d ' ' -f '3-'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment