Skip to content

Instantly share code, notes, and snippets.

@ryansb
Created April 16, 2013 17:10
Show Gist options
  • Save ryansb/5397662 to your computer and use it in GitHub Desktop.
Save ryansb/5397662 to your computer and use it in GitHub Desktop.
Generates JSON blob for each commit in the master branch containing the author's name and the files they edited in that commit. I feel slightly bad for generating JSON with `echo` and `sed`.
#!/bin/bash
set -e
echo $(echo -n [
for csha in $(git rev-list master)
do
echo -n "
{\"author\": \"`git log --pretty=format:'%an <%ae>' -n1 $csha`\",
\"files\": [`for i in $(git ls-tree --name-only -r $csha); do echo -n \\\"$i\\\", ; done`]
},"
done
echo -n ]) | sed -e 's/,]/]/g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment