Skip to content

Instantly share code, notes, and snippets.

@mohnoor94
Created December 7, 2020 11:17
Show Gist options
  • Select an option

  • Save mohnoor94/ab7c685d8ea8e70e890155f9c8d43a40 to your computer and use it in GitHub Desktop.

Select an option

Save mohnoor94/ab7c685d8ea8e70e890155f9c8d43a40 to your computer and use it in GitHub Desktop.

Revisions

  1. mohnoor94 renamed this gist Dec 7, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. mohnoor94 created this gist Dec 7, 2020.
    14 changes: 14 additions & 0 deletions git_uncommit
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    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'!