Skip to content

Instantly share code, notes, and snippets.

@stretchkennedy
Created April 12, 2016 03:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stretchkennedy/74739588858f3083e63516d73bc9cfca to your computer and use it in GitHub Desktop.
Save stretchkennedy/74739588858f3083e63516d73bc9cfca to your computer and use it in GitHub Desktop.
function escape_chars {
sed 's/"/""/g'
}
function format {
date=$(git log -n1 --pretty=format:%cD "$1" | escape_chars)
author=$(git log -n1 --pretty=format:'%aN <%aE>' "$1" | escape_chars)
sha=$(git log -n1 --pretty=format:%h "$1" | escape_chars)
message=$(git log -n1 --pretty=format:%B "$1" | escape_chars)
echo "\"$date\",\"$author\",\"$sha\",\"$message\""
}
echo '"date","author","sha","message"'
for hash in $(git rev-list --all)
do
format $hash
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment