Can i detect all branches in my github repos? I'd like to write a .sh script that loops thru the branches and pulls each one.
2 Answers
git fetch will bring down all branches from the remote repo. Note that it will not pull the branches, pull is fetch + merge, which is probably not what you want to do.
2 Comments
Boz
I need to detect and then pull each branch into a separate folder. Look at this post to see when I asked this question stackoverflow.com/questions/6803119/… any comments welcome.
Tekkub
This might be what you're after then: stackoverflow.com/questions/6270193/…
The github2 module for Python provides an API library with commands for listing the branches in a repo, see this documentation.
If Python isn't your thing, take a look at the list of libraries for other languages.
1 Comment
Boz
Great. And here is the command. GET /repos/:user/:repo/branches