This script generates backdated Git commits for educational and experimental purposes. It allows you to create commits for the past year (or any specified range of days), which can be useful for populating your GitHub contribution graph.
This script is for educational and knowledge purposes only. Use it responsibly and ensure that you comply with the terms and conditions of the platforms you interact with.
- Generates backdated Git commits.
- Automates file modification, staging, and committing.
- Pushes all commits to a remote repository.
Before using this script, ensure the following:
- You have Python installed on your system.
- Git is installed and properly configured.
- You are in a Git repository, and the repository is connected to a remote origin.
-
Clone or download this repository.
-
Navigate to the directory in your terminal.
-
Ensure the script has write permissions to the file
demo.txt
. -
Run the script:
python main.py
This will generate backdated commits for the past year.
- Date Calculation:
- The script calculates dates for the past year using Python’s
datetime
andtimedelta
modules.
- The script calculates dates for the past year using Python’s
- File Modification:
- It writes to
demo.txt
for each backdated day.
- It writes to
- Git Operations:
- Stages and commits changes for each date.
- Pushes all commits at the end of the process.
makeCommits(days: int)
:- Recursively generates commits for the specified number of days.
- Change the
days_in_a_year
variable in the script to modify the number of backdated days. - Edit commit messages in the
git commit
command within the script.
-
Sample
demo.txt
contents after running the script:2023-12-01 <- Commit Listed in a Day! 2023-11-30 <- Commit Listed in a Day! ...
-
Git commit log:
$ git log --oneline abc123 Commit on 2023-12-01 def456 Commit on 2023-11-30 ...
- Ensure the repository is public and commits are pushed to the main branch to reflect on the GitHub contribution graph.
- This script simulates activity but does not represent actual project contributions.