Comment by lalaithion
3 months ago
None of these seem to preclude a command to make an arbitrary branch point to an arbitrary commit without changing anything else.
3 months ago
None of these seem to preclude a command to make an arbitrary branch point to an arbitrary commit without changing anything else.
You are looking for
Wouldn't the fail or break under any circumstance where they don't immediately share a history?
I just tested it by creating a repo with two branches without a common ancestor, and I was able to move a branch pointer to either history with update-ref, so no, I don't think so
This works if the branch exists or creates it if it doesn't exist, but not if it's checked out.
if it's checked out:
> but not if it's checked out
...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.
To me that looks like git is leaking implementation details left and right.
So much for "a branch is simply a pointer to a commit"...
1 reply →
Couldn't head just detach without any consistency issue?
5 replies →