To move the branch pointer of a checked out branch, one can use the git reset --hard command. But how to move the branch pointer of a not-checked out branch to point at a different commit (keeping all other stuff like tracked remote branch)?
To move the branch pointer of a checked out branch, one can use the
Share
You can do it for arbitrary refs. This is how to move a branch pointer:
where
-madds a message to the reflog for the branch.The general form is
You can pick nits about the reflog message if you like – I believe the
branch -fone is different from thereset --hardone, and this isn’t exactly either of them.