Thursday, August 14, 2014

Git reset soft/mixed/hard

What is the difference between git reset soft, mixed and hard? When doing reset in git, you can add --soft, --mixed or --hard switch, or leave it, --mixed is the default. What do this switches do?

  1. Code before changes
  2. Code after changes
  3. Changes staged on index
  4. Changes commited

Now if you issue

git reset --xxxx HEAD~1

--soft moves you back to (3), --mixed to (2) and --hard to (1)

Written with StackEdit.