我的计算机上有 140 个 git 存储库,每周可以处理其中 10-15 个。有没有办法知道是否忘记提交/推送我的一个项目?
这些存储库都位于同一位置:“C:/Projects”。
输出会是这样的
谢谢你!
一个非常简单的 python 脚本就可以为你做到这一点:
import glob
import subprocess
import os
from os.path import dirname
dirs = glob.glob('c:/projects/*/.git')
for dir in dirs:
dir = dirname(dir) #strip .git off the end
os.chdir(dir)
status = subprocess.check_call(('git', 'status'))
# Check status, and potentially do this
subprocess.check_call(('git', 'add', '-A'))
subprocess.check_call(('git', 'commit', '-m', 'Automatic Commit'))
subprocess.check_call(('git', 'push', 'origin', 'HEAD'))
Run Code Online (Sandbox Code Playgroud)
差不多就是这样了。你需要在你的计算机上安装 python,然后对其进行调整。
| 归档时间: |
|
| 查看次数: |
209 次 |
| 最近记录: |