-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_history_filler.py
More file actions
50 lines (35 loc) · 1.74 KB
/
github_history_filler.py
File metadata and controls
50 lines (35 loc) · 1.74 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import random
import subprocess
from datetime import datetime, timedelta
def run_cmd(cmd, env=None):
subprocess.run(cmd, shell=True, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
# Git config
run_cmd("git config user.name 'mandar1045'")
run_cmd("git config user.email 'mandar1045@users.noreply.github.com'")
# User requested from Feb 22 to today
start_date = datetime(2026, 2, 22, 10, 0, 0)
end_date = datetime(2026, 3, 12, 10, 0, 0)
current_date = start_date
total_commits = 0
env = os.environ.copy()
print("Starting to generate random commits from {} to {}...".format(start_date.date(), end_date.date()))
with open("contribution_history.log", "w") as f:
f.write("Feb 22+ contribution history log initialized.\n")
while current_date <= end_date:
# User requested 30-40 commits per day
commits_today = random.randint(30, 40)
for i in range(commits_today):
minute_offset = random.randint(0, 10 * 60)
commit_time = current_date + timedelta(minutes=minute_offset)
iso_time = str(commit_time)
env['GIT_AUTHOR_DATE'] = iso_time
env['GIT_COMMITTER_DATE'] = iso_time
with open("contribution_history.log", "a") as f:
f.write(f"Daily update entry for {iso_time}\n")
run_cmd("git add contribution_history.log", env)
run_cmd(f"git commit -m \"System update for {current_date.date()} #{i+1}\"", env)
total_commits += 1
print(f"Generated {commits_today} commits for {current_date.date()} (Total so far: {total_commits})")
current_date += timedelta(days=1)
print(f"Finished generating {total_commits} random commits. Please manually cherry-pick your latest commits and push.")