Green Git Bot is a Node.js tool that leverages the GitHub API via Octokit to automate commit generation. It allows you to transform your GitHub contribution graph by:
-
Backdating or future-dating commits: Create commits with custom dates.
-
Generating random commit patterns: Simulate natural commit activity.
-
Mapping input strings to commit patterns: Convert text or symbols into a grid of commit activity, allowing you to "print" designs on your GitHub contribution graph.
Note: Manipulating your contribution graph can be fun for demonstration or artistic purposes, but please use this tool responsibly in accordance with GitHub’s terms of service.
-
Custom Commit Dates: Generate commits on any specified date.
-
Dense Commit Generation: Control the number of commits per day to adjust the visual density of your contribution graph.
-
Input String Mapping: Map letters and symbols to a contribution grid using a 5×5 character map.
-
Random Patterns: Create random commit patterns to simulate activity.
-
Node.js: Version 14 or later is recommended.
-
GitHub Personal Access Token: Create one Personal access tokens (classic) from GitHub settings.
No configuration required
-
Clone the repository:
git clone https://github.com/mdazlaanzubair/green-git-bot.git cd green-git-bot -
Install dependencies:
npm install npm start
Green Git Bot currently exposes following three API endpoints for generating commit patterns:
/api/green-git-bot- Posts random commits/api/dense-commits- Posts dense commits between specified dates/api/input-string-mapping- Posts commits based on input string
View the swagger documentation API Docs
Green Git Bot uses Octokit to interact with the GitHub API. Its primary functions include:
-
Repository Management:
-
Checks if a repository exists.
-
Creates a new repository if it doesn't exist.
-
-
File Management:
-
Ensures required files (
README.mdandbot_commits.json) are present. -
Updates
bot_commits.jsonwith commit entries.
-
-
Commit Generation:
-
Generates commits with specified dates using the Git Data API so that the commit's author and committer metadata reflect the date provided.
-
Supports dense commit generation (multiple commits per day) and random commit distribution.
-
-
Pattern Mapping:
-
Uses a 5×5 character map to represent each letter or symbol.
-
Combines character matrices with spacing to form a larger grid.
-
Maps each grid cell to a specific date (using weeks for columns and days for rows) and generates commits accordingly.
-
Each character in the input string is represented by a 5×5 grid where:
-
1 indicates a commit point.
-
0 indicates no commit.
Example for characters A, B, etc.:
const charMap = {
A: [
[0, 1, 1, 1, 0],
[1, 0, 0, 0, 1],
[1, 1, 1, 1, 1],
[1, 0, 0, 0, 1],
[1, 0, 0, 0, 1],
],
B: [
[1, 1, 1, 1, 0],
[1, 0, 0, 0, 1],
[1, 1, 1, 1, 0],
[1, 0, 0, 0, 1],
[1, 1, 1, 1, 0],
],
// ... (other characters including space)
};Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request.
What's next?
Experiment with different patterns on your contribution graph. Create some cool designs something like heart, rocket or thumbs-up etc.
Green Git Bot is provided for educational and demonstration purposes. Misrepresenting your activity on GitHub may violate GitHub's terms of service. Use responsibly.
This project is licensed under the MIT License. See the License file for details.