Last active
May 4, 2020 10:39
-
-
Save stefanofiorentino/17a97904a50b8d5a51885e748024d737 to your computer and use it in GitHub Desktop.
git script to add to $PATH to get all sub-directories' repository commit sha
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 | |
GIT_REPOS_HOME=$PWD \ | |
find . -type d -name '.git*' ! -path "*/poky-tmp/*" 2>/dev/null | \ | |
sed 's/\.git$//g' | \ | |
xargs -I '{}' sh -c 'readlink -e {};' | \ | |
uniq | \ | |
sort | \ | |
xargs -I '{}' sh -c 'cd {}; echo "dir: $(pwd) url: $(git config --get remote.origin.url) branch: $(git rev-parse --abbrev-ref HEAD) hash: $(git rev-parse HEAD)"; cd $GIT_REPOS_HOME;' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment