Skip to content

Instantly share code, notes, and snippets.

@ashishtilara
Last active January 27, 2021 05:00
Show Gist options
  • Save ashishtilara/77162dfab4625d61085ec63ebde8d2ed to your computer and use it in GitHub Desktop.
Save ashishtilara/77162dfab4625d61085ec63ebde8d2ed to your computer and use it in GitHub Desktop.
Loop all directories and find the latest commit locally
#!/usr/bin/env bash
for d in ~/dev/*
do
if [ -d "$d" ]
then
cd $d
hash=$(git rev-parse HEAD)
name=$(printf "%25s\n" $(basename $d))
echo "$name - $hash"
cd ..
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment