1

I understand (as of just now) that when I clone a repo, I don't really clone it, I just bring the master down - this is how it works, right?

So I need to checkout a remote branch with tracking, that's fine, but how do I see the remote branches to know what I can checkout?

Update

So it turns out I should see them locally using git branch -a or -r but I don't. So my question remains, if all my branches have been pushed to remote, how do I see them? Where are they?

Luke

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
  • I changed the title. The old title reflected my misconception and can be confused with a more popular dupe question about showing branches. – Luke Puplett Apr 15 '13 at 11:56
  • Please read the update. I have pushed all my branches, I have cloned and now I cannot see them using the ways suggested. – Luke Puplett Apr 15 '13 at 16:56
  • How did you push the branches in the first place? Are you sure they are in the repo you think, not in some other remote repo? If yes, then `git clone` must have failed. – 1615903 Apr 16 '13 at 11:38

3 Answers3

3

I understand (as of just now) that when I clone a repo, I don't really clone it, I just bring the master down - this is how it works, right?

No. When you clone a repo, you really do clone it. You have everything related to that repo after that.

Use the command git branch -r to list remote branches.

Edit:

Thought I could elaborate a bit more. The term "remote branch" might be a bit misleading here. Those branches are not exactly remote, they are local, but they represent the state of the remote branch when you last time did a git fetch (or pull). I hope this might clear things up for you a bit.

1615903
  • 32,635
  • 12
  • 70
  • 99
  • Oh right. Thanks. This is helpful of itself. Months into using Git and still I have no idea what's going on. – Luke Puplett Apr 15 '13 at 10:38
  • @LukePuplett, you have to be familiar with the so-called "remote branches" to work with remote repositories -- please read [this chapter](http://git-scm.com/book/en/Git-Branching-Remote-Branches) of The Book. Reading the whole book is highly advised. – kostix Apr 15 '13 at 14:02
  • Thanks, I have actually read the whole thing and continue to, but I will have continuous problems. – Luke Puplett Apr 15 '13 at 16:42
  • Technically, this was the right answer. I just happened to have a dodgy server. We moved to Linux for the server and all is good. – Luke Puplett Aug 02 '13 at 08:09
0

Use "git branch -r" to see remote branches.

Noor Ahmed
  • 257
  • 1
  • 4
0

I think there are problems with the server. Obviously, there's no server product with Git so I had to use whatever I could find, so I used a simple ASP.NET Git server project available on a guy's blog.

Sometimes Git hangs and I've noticed the IIS worker process spinning at 99% which is bad news. We're all running over a VPN, too, which might be a contributing factor.

I quite regularly have to wipe the server repo and push everything again, the problem is so bad.

I'm also using the new Visual Studio 2012 Git support. This tells me all my branches are published although I don't think they were.

Having pushed all my branches again, they now show when cloned into a new folder. As I say, I think our Git setup here is broken or really not liking something about our environment.

Luke Puplett
  • 42,091
  • 47
  • 181
  • 266
  • _there's no server product with Git so I had to use whatever I could find_ - what do you mean? Regular git installation on the server will do just fine. – 1615903 Apr 17 '13 at 04:45
  • This is for Windows. I've asked a Linux/Mac/Java guy to put it on a CentOS VM (which, I think is as easy as you say). – Luke Puplett Apr 17 '13 at 17:02