Ryan Lundy
Ryan Lundy

Reputation: 210260

git - I seem to have too many remote branches. How did this happen? How do I fix it?

When I do this:

git branch -a

I see precisely this:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Do I have two remote branches? How did I get in this situation?

All I have is my local directory, MyProject, and my remote branch on the server, MyProject.git. Other projects on my PC just have master and remotes/origin/master. Where did this HEAD branch come from?

Upvotes: 2

Views: 1940

Answers (1)

Andrew Marshall
Andrew Marshall

Reputation: 96994

You only have one local branch and one remote branch.

  • master is a reference to your local branch, and the * means it is the currently checked-out branch.

  • remotes/origin/HEAD is the HEAD reference of the remote repository named origin, it is simply a pointer to the master branch in the origin remote repository.

  • remotes/origin/master is the reference to the master branch on the remote repository named origin.

The last two exist so that Git can keep track of where the remote repository is (or was at the last git fetch).

Upvotes: 5

Related Questions