Skip to content

Instantly share code, notes, and snippets.

@brianewing
Created August 9, 2013 13:41
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 brianewing/6193666 to your computer and use it in GitHub Desktop.
Save brianewing/6193666 to your computer and use it in GitHub Desktop.
Git command for opening files from previous commits / other branches in your editor
#!/usr/bin/env ruby
unless ARGV.length >= 2
STDERR.puts "git old <commit/refspec> <file> [file2] ..."
Kernel.exit(1)
end
ref = ARGV.shift
ARGV.each { |f| `git show #{ref}:#{f} | $EDITOR` }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment