Skip to main content
7 of 13
D'oh, an initial slash snuck in where it shouldn't have
Esteis
  • 4.9k
  • 4
  • 30
  • 45

You can do it for arbitrary refs. This is how to move a branch pointer:

git update-ref -m "reset: Reset <branch> to <new commit>" refs/head/<branch> <commit>

The general form:

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.

Adam A
  • 14.6k
  • 6
  • 32
  • 41