When I do a git log I might see something like
commit 919fef06cb740f1695448a18cc0627ee173c3eca (HEAD -> main, origin/main, origin/HEAD)
Author: Me <me@me.org>
Date: Wed May 19 11:52:32 2021 +0200
Some comment
I understand, HEAD points to the current local branch, and I can see the state is the same as the main branch on the remote repository (origin/main). But what does origin/HEAD mean? Can I be on origin/HEAD without being on other remote branch? Is the following situation possible?
commit 919fef06cb740f1695448a18cc0627ee173c3eca (HEAD -> main, origin/HEAD)
Author: Me <me@me.org>
Date: Wed May 19 11:52:32 2021 +0200
Some comment
>Solution :
origin/head is the default remote branch, which means if you clone that repository then that branch will be checkedout by default.
Lets say that there are 2 branches on the remote repository prod and main, the branch main is set as the default branch in the remote repo so clone it the branch we will by default be working on will be main, if you change the default branch to prod on the remote repo and clone it again then we will be working on the branch prod by default.