Note
This project is intended for learning and experimentation. Please use it responsibly and ethically.
The Commit Automation Script is a Node.js tool that automates Git commits with randomized timestamps. This script is perfect for filling up your GitHub contribution graph or simulating commit history for testing purposes.
β
Randomized Commit Dates β Generates commits over a specific time period.
β
Automated Git Process β Adds, commits, and pushes changes seamlessly.
β
Lightweight & Fast β No unnecessary dependencies.
β
Configurable Commit Count β Adjust how many commits you want.
Feature | Description |
---|---|
π Randomized Commits | Automatically generates commits with random timestamps. |
π Fully Automated | No manual intervention needed after execution. |
π Custom Date Ranges | Commits are spread over the past year (or user-defined range). |
π₯ Easy to Use | Just run the script and watch it work! |
π§ Customizable | Modify commit count and frequency easily. |
π GitHub Integration | Commits are automatically pushed to your remote repo. |
Ensure you have the following installed:
Clone the repository and navigate into it:
git clone https://github.com/mahmudnibir/AutoCommitter.git
cd AutoCommitter
Install dependencies:
npm install jsonfile moment simple-git random
Run the script:
node index.js
Modify the number of commits in the script:
makeCommits(100); // Change 100 to any number of commits you want
Simply execute:
node index.js # Runs the script
Check the generated commits:
git log --oneline --graph --decorate --all
1οΈβ£ Generates a random timestamp (past year or custom range).
2οΈβ£ Writes commit data to data.json
.
3οΈβ£ Uses simple-git
to stage, commit, and push.
4οΈβ£ Repeats until reaching the desired commit count.
5οΈβ£ Enjoy a fully automated commit streak!
const markCommit = (x, y) => {
const date = moment().subtract(1, "y").add(1, "d").add(x, "w").add(y, "d").format();
jsonfile.writeFile(path, { date }, () => {
simpleGit().add([path]).commit(date, { "--date": date }).push();
});
};
βοΈ Generates a commit timestamp.
βοΈ Writes commit data to a JSON file.
βοΈ Commits and pushes changes to the repository.
const makeCommits = (n) => {
if (n === 0) return simpleGit().push();
const x = random.int(0, 54);
const y = random.int(0, 6);
const date = moment().subtract(1, "y").add(1, "d").add(x, "w").add(y, "d").format();
jsonfile.writeFile(path, { date }, () => {
simpleGit().add([path]).commit(date, { "--date": date }, makeCommits.bind(this, --n));
});
};
βοΈ Calls itself recursively to generate multiple commits.
βοΈ Randomizes commit timestamps for natural distribution.
βοΈ Stops when n = 0
and pushes all commits.
When running the script, it prints generated commit dates:
2024-04-02T10:22:42+00:00
2024-06-16T10:22:42+00:00
2024-07-23T10:22:42+00:00
...
* 8f3a1b4 (HEAD -> main, origin/main) 2024-07-23T10:22:42+00:00
* 7e2b9f6 2024-06-16T10:22:42+00:00
* 3a4c2e1 2024-04-02T10:22:42+00:00
π‘ Want to improve the script? Contributions are welcome!
Step | Action |
---|---|
π Fork | Clone the repo & create a new branch |
π§ Develop | Make your changes, write clear commit messages |
π Push | Push to your fork & create a PR |
π Review | Wait for approval & merge |
π This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Nibir Mahmud
π§ Email: nibirbbkr@gmail.com
π¦ Github: @mahmudnibir
If you find this project helpful, please consider giving it a star β on GitHub! It helps others discover the project.