The Simplest Way To Use Git In Python Gitpyton Git Class

usecase

The aim of this how-to-guide🏁 is to make git working in Python scripts fast for simple tasks.

1. steps

  1. install gitPython
  2. import the module with
  3. use the class and pass commands with
  4. to get output in CLI, embed into a statement

2. examples

  • this is for
import git
print(' UPDATES '.center(80, '~'))
print(git.Git().pull('origin', 'master'))
  • output
~~~~~~~~~~~~~~~~~~ UPDATES ~~~~~~~~~~~~~~~~~~~~~~~
Already up to date.

3. sources