The differences of suffixes of git reset

File statuses in git

  • Not Under git version control system
  • Modified but remain unstaged
  • Staged

Suffixes of git reset

–hard

Dangerous operation. All changes (including staged and unstaged) between the current commit and the target commit will be discarded.

–mixed

Moderate operation. All changes (Including staged and unstaged) between the current commit and the target commit will be reserved. However, staged and unstaged changes will both become unstaged.

–soft

Conservative operation. All changes (including staged and unstaged) between the current commit and the target commit will be reserved. While staged changes will remain staged, unstaged changes will remain unstaged.

Changes of files that are not under git version control system will not be affected by this command. That is to say, whether we use git reset --hard, git reset --mixed, or git reset --soft those changes will not be erased.