📜  如何使用 git 和 python 代码示例

📅  最后修改于: 2022-03-11 14:45:27.533000             🧑  作者: Mango

代码示例1
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!