I would like to reset the local master
branch to the commit that origin/master
points at. This operation should make a reflog entry so that it can be reverted if need be. It is a requirement that this operation doesn't change the index, working tree, and that it can be performed regardless of the current HEAD, without moving HEAD or checking out any specific commit.
In other words, what is a safe git CLI equivalent of git rev-parse origin/master > .git/refs/heads/master
?
Considered options:
git branch -f master origin/master
- Not acceptable because it doesn't leave a record in the reflog