#!/bin/bash
file="$1" anno="$file.anno" prev="" export GIT_DIFF_OPTS=-u0
rm $anno touch $anno
revs=`git-rev-list HEAD | tac`
for rev in $revs; do if [ ! -z "$prev" ]; then git-diff-tree -p $prev $rev $file \ | sed -e "/^--- /p" \ -e "/^+++ /p" \ -e "/^--- /d" \ -e "/^+++ /d" \ -e "s/^-/-$prev /g" \ -e "s/^+/+$rev /g" | patch $anno fi prev=$rev done
* gives a warning when the diff is empty * has a problem with "\ No newline at end of file"