by lalaithion · 1y ago · 0 comments
git update-ref <branch-name> <commit-sha> git branch -f branch_name commit
if it's checked out: git reset --hard commit...and for a good reason that should be apparent to anyone who understands git's model (HEAD points to a ref in this case, so if you suddenly change what that ref points to without updating the working tree you create an inconsistency).
You can do that manually of course (with `git update-ref` or even a text editor), but then you get to clean up the mess yourself.
So much for "a branch is simply a pointer to a commit"...
If a git repo was purely a collection of meaningless pointers and graph nodes, git would be a graph manipulation utility, not a version control system. The fact that some of those pointers have a meaning is what makes it useful and it doesn't contradict the fact that what you're working on is still just a bunch of pointers and nodes.
"error: ref in use by higher layers" makes much more sense to me in this case.