Skip to content

Instantly share code, notes, and snippets.

@cshjin
Created August 20, 2024 13:52
Show Gist options
  • Save cshjin/c285d1eb0d517de61470a8a690cb9de3 to your computer and use it in GitHub Desktop.
Save cshjin/c285d1eb0d517de61470a8a690cb9de3 to your computer and use it in GitHub Desktop.
Go through each of the subfolder and run git fetch if the folder is a git repo
''' Go through each of the subfolder and run git fetch if the folder is a git repo.'''
import os
import subprocess
def check_update():
''' Go through each of the subfolder and run git fetch if the folder is a git repo.'''
for root, dirs, files in os.walk('.'):
if '.git' in dirs:
print('Fetching %s' % root)
subprocess.call(['git', 'fetch'], cwd=root)
if __name__ == '__main__':
check_update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment