Skip to content

Instantly share code, notes, and snippets.

@mohnoor94
Created December 7, 2020 11:17
Show Gist options
  • Save mohnoor94/ab7c685d8ea8e70e890155f9c8d43a40 to your computer and use it in GitHub Desktop.
Save mohnoor94/ab7c685d8ea8e70e890155f9c8d43a40 to your computer and use it in GitHub Desktop.
git uncommit && git cancel_uncommit commands!
git-uncommit () {
if [[ $# -eq 0 ]]
then
echo '!! Please enter the number of commits you want to undo!'
else
git reset --soft HEAD~$1
echo ">> Magic done: $1 commit(s) rolled back!"
fi
} # Undo (Soft reset) last N commits!
git-resetHead () {
git reset 'HEAD@{1}'
echo ">> Magic done: uncommit commands cancelled!"
} # Undo 'git reset'!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment