Skip to content

Instantly share code, notes, and snippets.

@john-theo
Created December 21, 2022 05:14
Show Gist options
  • Select an option

  • Save john-theo/e563367b8c37d5e960a01b0865f57fd8 to your computer and use it in GitHub Desktop.

Select an option

Save john-theo/e563367b8c37d5e960a01b0865f57fd8 to your computer and use it in GitHub Desktop.
Find the earliest commit of every branch in a repo.
git fetch
brs=$(git branch -v -a | awk '{print $1}' | sed 1,2d)
IFS=$'\n'; brs=($brs); unset IFS
for i in "${brs[@]}"
do
msg=$(git log $i --pretty=format:"%h%x09%aD%x09%s" | tail -1)
echo "$msg\t\t$i"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment