Skip to content

πŸš€ AutoCommitter is an educational script that automates Git commits with custom timestamps, helping you learn Git automation, scripting, and workflow management. It generates realistic commit patterns using Moment.js, Simple-Git, and Random, making it great for profile heatmaps and contribution streaks.

License

Notifications You must be signed in to change notification settings

mahmudnibir/AutoCommitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Œ Commit Automation Script

GitHub Repo stars GitHub forks GitHub contributors GitHub issues GitHub last commit GitHub license Node.js Version GitHub Pull Requests GitHub Code Size Platform


Note

This project is intended for learning and experimentation. Please use it responsibly and ethically.


πŸ“š Table of Contents

Overview

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.


Features

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.

Installation

πŸ”Ή Prerequisites

Ensure you have the following installed:

  • Node.js (v16 or later)
  • Git (properly configured with a remote repository)

πŸ”Ή Setup

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

Usage

1️⃣ Customize Commit Count

Modify the number of commits in the script:

makeCommits(100); // Change 100 to any number of commits you want

2️⃣ Run the Script

Simply execute:

node index.js  # Runs the script

3️⃣ View Commit History

Check the generated commits:

git log --oneline --graph --decorate --all

How It Works

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!


πŸ“œ Code Breakdown

1️⃣ markCommit(x, y) – Creates a Single Commit

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.

2️⃣ makeCommits(n) – Recursively Generates Commits

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.


πŸ“· Example Output

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
...

βœ… Git History Example (git log --oneline --graph)

* 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

Contribution Guidelines

πŸ’‘ Want to improve the script? Contributions are welcome!

πŸ“Œ How to Contribute

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

License

πŸ“ This project is licensed under the MIT License. See the LICENSE file for details.


Contact

Developed by Nibir Mahmud

πŸ“§ Email: nibirbbkr@gmail.com
🐦 Github: @mahmudnibir


Support

If you find this project helpful, please consider giving it a star ⭐ on GitHub! It helps others discover the project.


About

πŸš€ AutoCommitter is an educational script that automates Git commits with custom timestamps, helping you learn Git automation, scripting, and workflow management. It generates realistic commit patterns using Moment.js, Simple-Git, and Random, making it great for profile heatmaps and contribution streaks.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published