Answers for "How to use git with python"

1

How to use git with python

import subprocess
PIPE = subprocess.PIPE
branch = 'my_branch'

process = subprocess.Popen(['git', 'pull', branch], stdout=PIPE, stderr=PIPE)
stdoutput, stderroutput = process.communicate()

if 'fatal' in stdoutput:
    # Handle error case
else:
    # Success!
Posted by: Guest on August-06-2021

Code answers related to "How to use git with python"

Python Answers by Framework

Browse Popular Code Answers by Language