Email or username:

Password:

Forgot your password?
Top-level
Janne Moren

@b0rk
Re: heads - this is how I understand them:

A "head" isn't a branch; it's the tip of the branch. Branches are like Hydras, with a head at the end of every branch.

HEAD is like a cursor in database operations or in an editor, or your current directory. It's where you are and your operations take effect. Usually it's the commit at the head of the current branch, but if you move it to a non-tip commit, it's no longer at a head - HEAD has detached from the head of the branch.

2 comments
Peter Nerlich

@jannem @b0rk Came here to say that, essentially. My mental model is that there is no fundamental difference between HEAD, branches and tags – all are refs, fancy names for human navigation, which are pointing to a commit. Git uses HEAD to keep track of where I am, meaning which commit my working directory should be compared to and any new commit should reference as its parent. If I came to the current HEAD by checking out a branch, that branch ref is now also being updated to point the new commit, while tags always remain where they point to.

@jannem @b0rk Came here to say that, essentially. My mental model is that there is no fundamental difference between HEAD, branches and tags – all are refs, fancy names for human navigation, which are pointing to a commit. Git uses HEAD to keep track of where I am, meaning which commit my working directory should be compared to and any new commit should reference as its parent. If I came to the current HEAD by checking out a branch, that branch ref is now also being updated to point the new commit,...

Julia Evans

@peternerlich @jannem thanks but I know all of this, I chose to explain it a different way intentionally

Go Up