Home > Blockchain >  Meaning of `HEAD -> main` vs `origin/HEAD`?
Meaning of `HEAD -> main` vs `origin/HEAD`?

Time:01-23

When I do git log --oneline on a local branch that is ahead of origin by a few commits, I get something like:

ff0dc35 (HEAD -> main) Style headers
08183f1 Fix <Title>s
071d82e (origin/main, origin/HEAD) Style list items
9b24f09 Add style.css
b9fd2fa Add index.html and 3 other pages
69748ca Initial commit

From this answer, I understand that

  • HEAD refers to the commit that my repo is currently pointing at
  • main is the branch
  • origin refers to the remote repo

What I don't understand is the difference between the -> notation (e.g. HEAD -> main) vs the / notation (e.g. origin/main and origin/HEAD). What does each thing mean?

  • HEAD -> main
  • origin/main
  • origin/HEAD

CodePudding user response:

HEAD is always where you are standing (very different concept from svn's HEAD, just in case). If you have a local branch checked out, it will say HEAD -> some-branch. If you are not working on a local branch (a.k.a. detached HEAD state), it would show up as just HEAD, not pointing to anything. Then origin/main is main branch in origin remote. origin/HEAD is where HEAD of that remote repo is standing at the moment.

  • Related