3 ms·
If you're in a detached head state and create a new commit, you have a commit that isn't on a branch. The commit still has a parent, so it's not the branch that
by kleinsch 4y ago
If you're in a detached head state and create a new commit, you have a commit that isn't on a branch. The commit still has a parent, so it's not the branch that's tracking the sequence, it's the commit. Branches are just pointers that get updated as you add commits.
- sophacles 4y agoThis feels like declaring squares aren't rectangles because you can make rectangles that aren't a square.
- wonderbore 4y agoGit is only commits. Branches and tags are references to the commits; one moves while the other one doesn’t. That’s it. Commits link to their parent(s) until the initial commit. You can visualize a “branch” as a series of commits, but the same thing can exist without calling it a branch: A -> B -> C —> Initial Is that a branch? No. How about: /refs/heads/main = A That’s a branch, and it looks exactly the same as a tag: /refs/tags/v1 = A Neither a branch or a tag is “a series of commits” even if you think it does.
- deleted 4y ago[deleted]
- sophacles 4y ago> You can visualize a “branch” as a series of commits, but the same thing can exist without calling it a branch You can visualize a "square" as a rectangle with equal sides, but the same thing can exist without calling it a square.