-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmachine.py
More file actions
27 lines (20 loc) 路 688 Bytes
/
Copy pathmachine.py
File metadata and controls
27 lines (20 loc) 路 688 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import git
import datetime
repo_path = "file path" # Change this to your local repo path
commit_times = int(input("Enter the number of commits (<100): "))
if (commit_times > 100):
print("Please enter a number less than 100.")
exit()
repo = git.Repo(repo_path)
assert not repo.bare
file_path = os.path.join(repo_path, "x.txt")
for i in range(commit_times):
with open(file_path, "a") as file:
file.write(f"Commit {i+1} on {datetime.datetime.now()}\n")
repo.index.add([file_path])
repo.index.commit(f"Automated commit {i+1}")
print(f"Committed {i+1} times.")
origin = repo.remote(name="origin")
origin.push()
print("All commits pushed successfully!")