Skip to content

Instantly share code, notes, and snippets.

@haolian9
Created December 24, 2015 07:38
Show Gist options
  • Save haolian9/382bbaf84c5558059c31 to your computer and use it in GitHub Desktop.
Save haolian9/382bbaf84c5558059c31 to your computer and use it in GitHub Desktop.
function recover-last-version
{ #{{{
local commit_ref=$1
if [ ! "${commit_ref}" ]; then return 2; fi
for i in $(git diff HEAD "${commit_ref}" --name-only); do
vim -c 'Gvsplit HEAD~1:% | windo diffthis' -- "${i}"
done;
} #}}}
# require fugitive.vim
#
# use case:
# recover-last-version HEAD~1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment