Question

still getting used to git, using source tree as the Git client.

I have a Git repo that has the master branch checked out.

I had two clones of this repo.

Today origin/Head magically appeared in one of them.

So I cloned the repo again to see if origin/HEAD would appear again, it did.

In the new repo origin/HEAD points to origin/master, as I would expect.

In the original repo origin/HEAD points to a different branch. ie origin/my_branch.

What could have happened to make origin/HEAD appear? From what I have read origin/HEAD should point to the checked out branch in the origin, why would it be pointing to a different branch?

How can I make origin/HEAD point to where I think it should be pointing? Can I remove origin/HEAD without making changes to the origin? should I not care and ignore this inconsisitence?

have I got this all totally wrong?

Thanks!

Était-ce utile?

La solution

As mentioned in git remote set-head, origin/HEAD is the default branch (i.e. the target of the symbolic-ref refs/remotes/<name>/HEAD) for the named remote.

You can remove it without changing the remote repo itself, since it is a local reference to your remote default branch.

See "How does origin/HEAD get set?".

It can be set/updated with a git remote set-head origin -a, which is what you need to do to update it in your first repo.
It is set automatically on a git clone.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top