Search code examples
python-3.xgit-checkoutgitpython

How to execute --track, using GitPython(as a python script). "git checkout -B <branchname> --track origin/<TeamBranch>"


I can execute "git checkout -B --track origin/TeamBranch" through terminal. but I have the requirement to implement the above command through my script using Gitpython. can someone help me with this?

Thanks in advance.


Solution

  • You can use git directly

    git = repo.git
    git.checkout('HEAD', b="TeamBranch")