Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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