Skip to main content
5 of 13
Make it clear that the command takes a ref name, not a branch name

You can do it for arbitrary refs: git update-ref -m "reset: Reset <branch> to <new commit>" <ref> <commit>.

You can pick nits about the reflog message if you like - I believe the branch -f one is different from the reset --hard one, and this isn't exactly either of them.

You have to use the full reference name for <ref>: not <branch>, but refs/heads/<branch>.

Adam A
  • 14.6k
  • 6
  • 32
  • 41