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

Change the meaning of origin in git

We just changed the default branch name in our GitLab repository from qa to main. We left the old branch intact.

Before, git log origin.. would show me the differences between my current branch and qa. It still does that – it shows me the difference between my branch and the last commit to qa (not main, which is what we want). (This is after a fetch.)

git show origin/qa and git show origin display the same commit.

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

grep qa .git/config returns nothing.

git remote -v just shows the (correct) repository location.

How can we change the meaning of the origin reference?

>Solution :

Use git remote set-head. The name origin, treated as a revision, is shorthand for origin/HEAD, which you can write out explicitly, and origin/HEAD means what you set with git remote set-head. But I recommend not using origin/HEAD at all, neither with nor without the shorthand. Write out the actual name you mean, such as origin/qa, every time, so that it is not ambiguous.

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