dwynne
dwynne

Reputation: 916

Git remote has master but no HEAD

I'm new to Git, so I suspect that I'm misunderstanding something here, but I'll ask anyway.

Via TortoiseGit I do the following:

If I then Browse Refs I see the following:
heads/master
remotes/origin/master

What I find odd is that I don't see a HEAD on the remotes.

If I delete my local repo and then clone it from the server (I just pushed to above) and then browse the refs I see:
heads/master
remotes/origin/HEAD
remotes/origin/master

So why don't I see a remote head after the initial push?

NB. I've done the same via Git Bash command (ie. not Tortoise Git) and am seeing the same thing.

Upvotes: 5

Views: 4575

Answers (2)

ralphtheninja
ralphtheninja

Reputation: 133008

It's because HEAD is not a remote reference that you should push too, it's just a reference to the commit that HEAD of the remote repository points to. This repository on the server obviously has a working tree and is not created with a git init --bare command. I'm guessing Tortoise Git simply ignores it because some rules in the software. It sounds weird that git would fail to display it.

Upvotes: 3

shingara
shingara

Reputation: 46914

It's because you don't pull your repository. When you push you update the ref remote/origin/master, but not HEAD because it can be to other commit. If you pull after the HEAD arrive.

It's coming with your clone after. Fetch all refs from remote like HEAD and master

Upvotes: 0

Related Questions