DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Git-diff Last Two Commits Through TextMate

  • submit to reddit
        I believe this is how svn diff operates... but anyway, this alias will allow you to diff the last two commits in Git through TextMate. If you have a theme that supports Diff's then you'll see the differences clearly. Remove the last pipe statement (the mate part) to expose your diff in the console.

alias gitdiff='git log|grep commit|cut -d " " -f2|head -n 2|xargs -n 2 git diff -R|mate'


Filip Krikava replied on Tue, 2010/10/05 - 8:40am

Actually: git diff HEAD^ | mate

Filip Krikava replied on Tue, 2010/10/05 - 8:40am

Maybe an easier way: git diff -R HEAD HEAD~1 | mate