Skip to content

Instantly share code, notes, and snippets.

@yaauie
Created November 21, 2014 19:14
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 yaauie/5c06f73782832e530599 to your computer and use it in GitHub Desktop.
Save yaauie/5c06f73782832e530599 to your computer and use it in GitHub Desktop.
Lately I've been fat-fingering git commands, injecting a space between `gi` and `t` and failing to inject a space between that `t` and the command; this simple script fixes that.
#!/usr/bin/env ruby
# gi - a dynamic alias for poorly-typed git commands
# handle a command `gi tdiff --cached`,
# transparently as `git diff --cached`.
exit(127) if ARGV.empty?
exit(127) unless ARGV.first.start_with?('t')
argv = ARGV.dup
argv.unshift(argv.shift[1..-1])
exec('git', *argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment