What is difference between “git checkout -f” and “git reset –hard HEAD”?

The two of them have the exact same effect. I recommend you to choose the solution you’re the more comfortable with.

But if in this particular case the effect is the same, with different values it would be completely different. Basically (there is more, see linked topics) with a reset you move the current branch and the HEAD to a specific commit but with a checkout, you only move the HEAD . For more details see below.


Resources:

  • git reset
  • git checkout

On the same topic:

  • Is there a difference between git reset –hard HEAD and git checkout .?
  • Is there a difference between “git reset –hard hash” and “git checkout hash”?
  • Can you explain to me git reset in plain english?

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)