3

When I run git branch -a, it prints out like this, for ex:

branch_a
remotes/origin/branch_a

Few questions:

  1. What does branch_a indicate?
  2. What does remotes/origin/branch_a indicate?
  3. How do I delete remotes/origin/branch_a?
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
keruilin
  • 16,782
  • 34
  • 108
  • 175
  • Would http://stackoverflow.com/questions/3046436/how-do-you-stop-tracking-a-remote-branch-in-git/3046478#3046478 help for 3? – VonC Jun 18 '10 at 10:41

2 Answers2

2
  1. branch_a indicates that you have a local branch called branch_a.
  2. remotes/origin/branch_a indicates that you have a remote called origin, and you are tracking the branch_a within the origin remote. This isn't necessarily associated with your own branch_a, but it probably is (git branch -a doesn't say).
  3. Since the remotes/origin/branch_a is a remote tracking branch, it's required if your own branch_a is set up to track the remote. If not, then deleting the origin remote should remove it, or you might be able to simply git branch -d remotes/origin/branch_a.
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • This command worked for me: git branch -d -r origin/branch_a. I had already deleted local, so used that command to get rid of remote. – keruilin Jun 18 '10 at 11:09
0
  1. branch_a is the local 'tracking branch' for the remote branch_a.
  2. remotes/origin/branch_a is a remote branch, living on the origin repository.
  3. git push origin :branch_a removes the remote branch from the origin repository, despite looking a bit hackish. If you want to remove branch_a, run git branch -d branch_a.
Jordan Lewis
  • 16,900
  • 4
  • 29
  • 46
  • i downticked this because my understanding is that branch_a is not a tracking branch - it's just a local branch .... if branch_a is mapped to remote origin branch_a then git will auto-create locally-cached tracking-branch remotes/origin/branch_a – BaltoStar May 05 '15 at 01:23