This project is a simple Node.js script that creates backdated Git commits with random timestamps between a defined start and end date. It can be useful for:
- Populating your GitHub contribution graph
- Testing Git behavior with historical data
- Learning how to automate Git via Node.js
β οΈ Use responsibly! This script is for educational and testing purposes only.
- Generates random dates
- Commits a JSON file (
data.json
) with each random date as content - Commits are made with backdated timestamps using Gitβs
--date
option - Automatically pushes all commits after completion
- Node.js (v14+ recommended)
- Git installed and initialized in your project
- A remote Git repository set up (for the final push)
- Clone this repo or copy the script into your own project
- Install dependencies:
npm i
or
npm install jsonfile moment simple-git random
- Run the script:
node index.js
You can edit the last line to change the number of commits:
makeCommits(10); // Replace 10 with any number you want
- A random date is generated between the start and end range using
moment
andrandom
. - That date is written into a JSON file (
data.json
) to simulate a file change. - Git stages the file and commits it with a custom
--date
parameter. - After all commits are made, the script performs a
git push
.
Example console output might look like:
2023-07-14T10:23:00+00:00
2022-11-03T08:45:00+00:00
2024-05-19T17:30:00+00:00
...
These are the commit dates that will show up on your contribution graph.
This is for learning purposes and testing only. Misusing such tools to fake contribution history can violate platform guidelines or employer expectations.