Skip to content

Instantly share code, notes, and snippets.

@drmercer
Last active October 13, 2017 05:32
Show Gist options
  • Save drmercer/f18ef12c478692ccc99069f98d9c1eaf to your computer and use it in GitHub Desktop.
Save drmercer/f18ef12c478692ccc99069f98d9c1eaf to your computer and use it in GitHub Desktop.
Put this script somewhere in your $PATH. Then you can type "git gud" for help with the last git command you used
#!/bin/bash -i
last_command=$(fc -ln | grep -v 'git gud' | grep -E '^\s*git' | tail -n 1 | cut -d ' ' -f 3)
if [ -n "$last_command" ] ; then
git help "$last_command"
echo "(now ur gud at 'git $last_command')"
else
echo "No recent git command found :("
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment