Closed briantoby closed 4 months ago
This is not working. I'm not seeing any branches and fetch is not finding them; nor does git branch -r
.
The problem here is that use of a shallow install causes git to ignore all but the master branch. FWIW, git fetch --unshallow
pulls over all the history (takes a while) and still does not get the branches
However, this does get the branches:
git clone git@github.com:AdvancedPhotonSource/GSAS-II.git /tmp/g2 --depth 100
cd /tmp/g2
git remote set-branches origin '*'
git fetch (or git fetch -v --depth 100)
git branch -r
git checkout log
Python commands:
import git
repo = git.Repo('/tmp/g2')
repo.git.remote('set-branches','origin','*')
repo.git.fetch()
branchlist = [i.strip() for i in repo.git.branch('-r').split('\n') if '->' not in i]
To facilitate testing of branches, it would be useful to have a menu command (available only in debug mode) that allows one to switch to a remote branch (and back to master)
Steps needed:
brList = [i.split()[1] for i in g2repo.git.ls_remote('--heads').split('\n')]
)