-
Notifications
You must be signed in to change notification settings - Fork 540
How to identify branches and get their files #199
Comments
So far, I've figured to:
Is this a "correct" way of doing things? It seems pretty awkward to hardcode "refs/remotes/origin/" in there to find and define branches? The I'm not sure whether this is something arbitrary that each client chooses or if it is something that is universal across git? (I see the same difference when comparing git vs go-git on custom gitolite or Bitbucket, for instance) As far as I see right now, the way to identify branches would be to list references and then find all of the ones that have the prefix |
@skyflyer Thanks for taking the time to open the issue. The recommended way to do it is the one you're using. go-git behaves the standard way in this case.
There is no high-level API for
|
Closing this issue, since it's standard git behavior. |
@smola, thank you for your explanation and a client sample code to list remote refs. It is good to know I'm on the right track. |
I'm having troubles identifying branches. Is there a specific way I can identify remote branches and "check them out" locally?
I.e., I would like to know which remote refs are branches and how to check them out locally, so I can get their files.
While iterating through
Repository.References
, I see the following refs:Only refs/heads/master has the
IsBranch()
"flag" set to true. Others are false. I doubt that the only way to identify branches is to search for string prefixrefs/remotes/origin
(whereorigin
should not be special at all, and is just the default remote name, right)? (options.go
, line 13)Perhaps we could write an example? (I can write a few examples once this is clarified)
The text was updated successfully, but these errors were encountered: