Skip to content

Instantly share code, notes, and snippets.

@lebalz
Created December 28, 2020 16:50
Show Gist options
  • Save lebalz/e188f3eb2dffcef0d70e5f2391921dd9 to your computer and use it in GitHub Desktop.
Save lebalz/e188f3eb2dffcef0d70e5f2391921dd9 to your computer and use it in GitHub Desktop.
sync all git projects in a folder
from pathlib import Path
import os
root = Path(__file__).parent
git_folders = root.rglob("*.git")
for git_dir in git_folders:
git = git_dir.parent
print('stash and pull master: ', git)
res = os.system(f'(cd {git} && git stash && git checkout master && git pull)')
print(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment