Git patch sets
I needed to extract who did what on a project. The following script extracts a set of patches that have been contributed by the various authors. This result should resemble the exact same diff information of a ‘gitk –all‘.
#!/bin/sh
DEST=$1
PREV=""
( git log --reverse --pretty=format:"%ae %at %H" ; echo ) |
while read line
do
AUTHOR=`echo "$line" | awk '{print $1}'`
TIMESTAMP=`echo "$line" | awk '{print $2}'`
HASH=`echo "$line" | awk '{print $3}'`
mkdir -p $DEST/$AUTHOR
git diff $PREV $HASH > $DEST/$AUTHOR/patch-$TIMESTAMP-$HASH.diff
PREV=$HASH
done
Please let me know if there is an easier way to do this.


