On Apr 11, 2011, at 14:39, Rory O'Bryan wrote:
I can't see any options for cloning a particular branch, but my remote repository is just a "bare" repository on my local filesystem, so perhaps these options are only there for "real" remote repositories. (Although I do need to file a bug as Xcode cant see any of the commits inside my bare repository, which may be why it can't pick up any alternative branches either.)
You have to look in the right place. There are 4 possibilities, and they all show different things:
1. If you select the remote repository entry, it shows you what branches are in that repository, and gives you a Clone button to pull down a copy.
Note that there is currently a bug where selecting a second remote repository entry, if a remote one is already selected, fails to update the window with the information from the second repository. You have to click on a local repository before you can properly switch the display to the second remote repository.
2. If you select the root (top) of a local repository entry, it shows you the commits to all branches of that repository.
3. If you select the branches (2nd row) of a local repository entry, it shows you the branches in the local repository. There are buttons to add and remove branches.
4. If you select the files (3rd row) of a local repository entry, it shows you the files in the current branch, with buttons to pull, commit and switch branches, but not push. Sometimes you have to click Refresh to see the latest commits.
So maybe you were looking in the wrong place.
The UI for SCM is utterly miserable, because it works from the point of view of the repository, not the user. (Someone needs to read the HIG.) On top of that, or perhaps because of that, it fails to provide for the major usage case of a remote repository mirroring a local one. Xcode 3 had the same problem.
I'll add, since I'm venting, that there's another drastic flaw in the current implementation. Xcode 4 keeps necessary information about the Repositories tab entries in ~/Library/Developer/Xcode. If that information is missing, local repositories that track remote repositories are pretty much irretrievably broken (as far as Xcode is concerned, that is). Why might that information be missing? Well, for example, if you take a project folder with its git repository to a different Mac, which you wouldn't expect to be dangerous.
This makes sense if you consider a big repository with hundreds of branches, if you got all the historical branches set-up locally by default it would be overwhelming. So it makes some sense that you need to pick the branches you are interested in. Obviously there's no Xcode interface for this currently so it's back to the command line.
The obvious UI would be to allow the selection of multiple branches in the remote repository to pull down. Currently, you can only select a single branch.
I found the following GIT command fixes this error without having to trash the local repository...
git branch --set-upstream master origin/master
Ah, thanks for figuring it out. I'll make use of it in the future.
(I've only just joined the mailing-list so I didn't have the original copy of this mail to reply to, I'm hoping just having the matching subject line will add this to the correct thread?)
It did.