Created
August 20, 2024 13:52
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' 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