0

I currently have two branches dev/A and main. The repository is cloned with main branch and I've checked out a new branch called dev/A

$git branch --show-current
dev/A
main

Both of which are pointing to the respective origins as upstream. My current branch is dev/A

$git branch --show-current
dev/A
$cat .git/HEAD
ref: refs/heads/dev/A

Both commands above, as far as my understanding goes, are to pointers of origin/HEAD. However, git branch -r and git tree diagram they tell say that origin/HEAD is pointing to origin/main

$git branch -r
origin/HEAD -> origin/main
origin/dev/A
origin/main

And in git tree origin/HEAD points to the same git commit as where origin/main is when origin/dev/A is the latest commit. But git log gives me HEAD pointing to origin/dev/A

$ git log
commit <lastest commit id> (HEAD -> dev/A, origin/dev/A)
# commit details here

commit <lastest commit id from main branch> (origin/main, origin/HEAD, main)
# commit details here

Is there a difference between origin/HEAD and HEAD? If so, what are the differences?

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
milkyway42
  • 144
  • 1
  • 6

0 Answers0