如何使用python检查git repo中是否存在未老化/未提交的更改或未推送的提交
我只知道命令行
git status
会告诉你的
- 未时效变化
- 未承诺阶段
- 以及当前分支是否在远程服务器后面提交
如果我为函数提供根路径,例如(“C:/ProgramFiles”),
如果代码可以给出一个列表,其中每个元素都是
(path of this repos found under the root path, Unstaged/uncommited changes, Untracked files: , Latest commit is pushed)
Tags:
您可以使用GitPython包提供帮助
pip install GitPython
然后,此脚本可以为您提供一个起点:
使用
os.system()
函数,您可以通过python发送shell命令:如果要管理输出,可以使用
os.popen()
:并在
output
中查找shell打印相关问题 更多 >
编程相关推荐