Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a2e5c1713c
Fetching contributors…

Cannot retrieve contributors at this time

executable file 30 lines (25 sloc) 0.655 kb
#!/bin/bash
#
# easy undo a file, a commit or a merge
if [ $# -lt 1 ]
then
echo "Usage : g undo <file|'commit'|'merge'>"
exit
fi
read -p "warning: the action will discard your changes, please confirm (y/n)? " -n 1 -r
echo
[[ $REPLY = [nN]* ]] && exit 0
case "$1" in
"commit")
#TODO: Validate local commits
echo "Undoing last commit and reverting changes to the staging area."
"$GIT_EXE" reset --soft HEAD^
;;
"merge")
#TODO: Validate local commits
echo "Reverting back prior to the last merge."
"$GIT_EXE" reset --hard ORIG_HEAD
;;
*) "$GIT_EXE" checkout -- "$1"
;;
esac
Jump to Line
Something went wrong with that request. Please try again.