tj.git-extras/bin/git-undo
nickl- 501d4b2759 Recommit of @d153e9c Changes to PR #114.
Added -s --soft arguments as well.
Default roll-back one with HEAD^ and only using ~ if commit count more than 1.
Added auto complete.
Updated documentation.
Attitude adjustment: don't throw errors and say NO as suggested in #114, have a can do attitude instead, leave the errors up to git to report.
2012-07-23 00:11:11 +02:00

20 lines
318 B
Bash
Executable file

#!/bin/sh
back="^"
case "$1" in
-h|--hard)
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
git reset --hard HEAD$back && exit 0;
;;
-s|--soft)
test $2 -gt 1 > /dev/null 2>&1 && back="~$2"
;;
*)
test $1 -gt 1 > /dev/null 2>&1 && back="~$1"
;;
esac
git reset --soft HEAD$back
git reset