Skip to content

Instantly share code, notes, and snippets.

@danrspencer
Created August 25, 2016 13:08
Show Gist options
  • Save danrspencer/3a7c9216df4707e93712854a2cfe663f to your computer and use it in GitHub Desktop.
Save danrspencer/3a7c9216df4707e93712854a2cfe663f to your computer and use it in GitHub Desktop.
Setup Git undo alias
#!/bin/bash
# Credit to: http://megakemp.com/2016/08/25/git-undo/
git config --global alias.undo '!f() { \
git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; \
}; f'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment