-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathBulkGit.py
More file actions
20 lines (19 loc) · 727 Bytes
/
BulkGit.py
File metadata and controls
20 lines (19 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Commit and push all changes of all repositories in a directory.
import os
import sys
if __name__ == "__main__":
dir = input("Enter directory: ")
if not os.path.isdir(dir):
print("Invalid directory.")
sys.exit(0)
for root in os.listdir(dir):
for file in os.listdir(os.path.join(dir, root)):
if file.endswith(".git"):
os.chdir(os.path.join(dir, root))
os.system("git add .")
os.system(
'git commit -m "Updated contact info"'
) # Adding your git commit message here.
os.system("git push")
print("Repository " + root + " updated.")
os.chdir("..")