I have cloned a repository with GitPython, now I would like to checkout a branch and update the local repository\'s working tree with the contents of that branch. Ideally, I
If the branch exists:
repo.git.checkout('branchename')
If not:
repo.git.checkout('-b', 'branchename')
Basically, with GitPython, if you know how to do it within command line, but not within the API, just use repo.git.action("your command without leading 'git' and 'action'")
, example: git log --reverse
=> repo.git.log('--reverse')