How to check out a branch with GitPython

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')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)