Skip to content

Instantly share code, notes, and snippets.

@Sparkboxx
Created January 27, 2025 15:39
Show Gist options
  • Save Sparkboxx/ec13332e88d0dddb188dacb317da8174 to your computer and use it in GitHub Desktop.
Save Sparkboxx/ec13332e88d0dddb188dacb317da8174 to your computer and use it in GitHub Desktop.
commit-sha.sh
echo `PWD`
shopt -s nullglob
for path in *; do
echo ""
echo ""
if [ -d "${path}" ]; then
echo "# ${path}"
dirname="$(basename "${path}")"
git_dir_name="${dirname}/.git"
if [ -d $git_dir_name ]; then
cd $dirname
git log -1 --format=%H > ../commit-${dirname}.txt
cd -
else
echo "${path} is not a GIT repository."
continue
fi;
else
echo "Skipping: ${path}"
continue
fi;
done
for file in commit-*; do echo "===== $file ====="; cat "$file"; done > report-commits.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment