As the title says. I want to execute an operation equivalent to the following command in python.
git clone <git_repo> -b <branch>
When implementing using GitPython Execute as follows.
git.Repo.clone_from(<git_repo>, <dest>, branch=<branch>)
Clone the'gh-pages' branch of GitPython to'/ home / ser / GitPython':
python
#!/usr/bin/env python
import git
git.Repo.clone_from('https://github.com/gitpython-developers/GitPython',
'/home/user/GitPython',
branch='gh-pages')
Clone GitPython'1.0.1'tag to'/ home / user / GitPython':
python
#!/usr/bin/env python
import git
git.Repo.clone_from('https://github.com/gitpython-developers/GitPython',
'/home/user/GitPython',
branch='1.0.1')
Recommended Posts