Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the difference between "origin/main" and "origin/HEAD" in a git log?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading