Another way you can do this without installing a separate tool is to disable git status output and pass it through sed, and then return to git diff. Its a long command, so you can put it in your .bashrc and alias. For example, putting this in my .bashrc:
myfunction() { git status --porcelain | sed -n "${1} s/^...//p' | xargs git diff } alias gd=myfunction
Then i can do
>> git status M main.cpp M tipsy.cpp M other.cpp >> gd 2
And the output of git diff is the second file.
EDIT: I combined the two seeds into one because the two separate were stupid.
timdykes
source share