Table of Contents

14 Advanced Usage

Remove Accidental Commit (lose changes)

This doesn't work if you've already pushed the commit to a remote.

Lose changes

  # remove the last commit from the current branch
  git reset HEAD~ --hard

keep changes

  # remove the last commit from the current branch
  git reset HEAD~ --soft