I don't see an option to checkout or list remote/local branches in this module
+3
A:
After you’ve done
from git import Git
g = Git()
(and possibly some other command to init g
to the repository you care about) all attribute requests on g
are more or less transformed into a call of git attr *args
.
Therefore:
g.checkout("mybranch")
should do what you want.
g.branch()
will list the branches. However, note that these are very low level commands and they will return the exact code that the git executables will return. Therefore, don’t expect a nice list. I’ll just be a string of several lines and with one line having an asterisk as the first character.
There might be some better way to do this in the library. In repo.py
for example is a special active_branch
command. You’ll have to go through the source a little and look for yourself.
Debilski
2010-03-18 20:23:41
when i run r = Git.clone("git ...") r.checkout("develop") does not work.. AttributeError: 'str' object has no attribute 'checkout'
Mike
2010-03-18 20:28:05
ok looks like I need to run a g = Git("dir") then I can checkout
Mike
2010-03-18 20:29:15
Could be. I just cloned with `g` and then it worked.
Debilski
2010-03-18 20:32:59