Skip to content

Instantly share code, notes, and snippets.

@CrashenX
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CrashenX/bb823f26b653168154f8 to your computer and use it in GitHub Desktop.
Save CrashenX/bb823f26b653168154f8 to your computer and use it in GitHub Desktop.
Opens all files modified since specified revision of a git repo in vim and Gdiff them
#!/bin/bash
# You'll need to get vim-fugitive:
# https://github.com/tpope/vim-fugitive
if [ $# -eq 0 ]
then
since='HEAD^'
show_diff=false
else
since=$1
show_diff=true
fi
git_cmd="git diff-tree --no-commit-id --name-only -r $since..HEAD"
gdiff="'+tabdo Gdiff $since' +tabfirst"
vim_cmd="vim -p `$git_cmd`"
if [ $show_diff == true ]
then
vim_cmd="$vim_cmd $gdiff"
fi
eval $vim_cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment