Skip to content

Call “git pull” from Python

Imagine you set up a project that is directly cloned from git and you want to update it from the projects logic itself instead of navigating to it and perform a git pull manually. But using subprocess raises problem and makes the process very difficult. However, there is a library called GitPython, which simplifies the whole process and save you a lot of hassle. With GitPython, you can perform a pull like this:

[sc name=”src” url=”https://stackoverflow.com/questions/15315573/how-can-i-call-git-pull-from-within-python” ]

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.