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 problems 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:

import git 

g = git.cmd.Git(".")


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.