0

There is the output of git branch -av command. Now I am on the dev branch.

***dev** 3f126e0 Comment...
master 7a47db8 Another comment...
remotes/origin/HEAD   -> origin/master
remotes/origin/dev 3f126e0 Comment...
remotes/origin/master 7a47db8 Another comment...

From the book Pro Git by Scott Checkon.

How does Git know what branch you’re currently on? It keeps a special pointer called HEAD.

Why does HEAD point to origin/master while I am on dev?

dertkw
  • 7,798
  • 5
  • 37
  • 45
Maksim Dmitriev
  • 5,985
  • 12
  • 73
  • 138

2 Answers2

7

HEAD isn't pointing at origin/master; remotes/origin/HEAD is pointing at origin/master.

See what HEAD is pointing at with git symbolic-ref HEAD.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
1

It just tells you that master is the default branch of your remote repository. But yeah anyway Head is normaly the checked out branch, but in this sittuation it just provides the default branch info. Its not that importend anyway. A case would be if you clone a repo the default branch gets used.

SG 86
  • 6,974
  • 3
  • 25
  • 34