Created
December 7, 2020 11:17
-
-
Save mohnoor94/ab7c685d8ea8e70e890155f9c8d43a40 to your computer and use it in GitHub Desktop.
git uncommit && git cancel_uncommit commands!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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