The Git Commit Metadata Rewriter is a specialized utility engineered in Go to retroactively modify Git commit metadata, including author names, email addresses, and timestamps, for cloned GitHub repositories. The system integrates with an AI model to generate realistic, non-uniform commit distributions, subsequently rewriting the repository's history to reflect the updated timelines.
- Video Demonstration: YouTube
- Commit Testing Sample: Test Repository
- Automated Repository Management: Seamlessly clones public GitHub repositories for localized processing.
- AI-Driven Timestamp Generation: Leverages the OpenRouter API to programmatically generate realistic commit date distributions.
- History Modification: Utilizes Git filter-branch operations to systematically rewrite commit history with the newly generated metadata.
- Automated Synchronization: Executes force-pushes to synchronize the rewritten history with the remote repository origin.
- State Cleanup: Automatically purges temporary files and local repository clones upon process completion to maintain system hygiene.
- Initialization: Clones the specified target GitHub repository to the local environment.
- Extraction: Exports the existing commit log to
edited_commits.txt. - Generation: Interfaces with the AI model to establish new, realistic commit dates within a defined timeframe.
- Data Mapping: Compiles the updated commit metadata into
updated_commits.txt. - Execution: Rewrites the Git history applying the new metadata parameters.
- Synchronization: Force-pushes the modified commit history to the remote source.
- Cleanup: Removes all local artifacts and cloned data.
Clone the repository and resolve dependencies:
git clone <repository-url>
cd Hackathon-Time-Script
go mod tidyAn OpenRouter API key is required for timestamp generation.
Create a .env file in the project root directory:
API_KEY=your_openrouter_api_key_hereModify main.go to define the target repository and the desired date range parameters:
repo: Set to the target repository identifier (e.g.,MishraShardendu22).start/end: Define the boundaries for the newly generated commit dates.
go run main.goThe system relies on the OpenRouter API to produce plausible commit timelines. The underlying prompt is strictly constrained to alter timestamps while preserving original author attributions and commit messages. Failure to provide a valid API key will result in immediate process termination.
- Missing API_KEY: Verify the
.envfile is present and properly formatted. - Authentication Failures: Ensure SSH keys are correctly configured with GitHub and that the executing environment holds sufficient push permissions for the target repository.
- Empty AI Responses: Confirm API key validity and network connectivity. An index out of range panic typically indicates a malformed or empty API response.
- Protected Branches: Force-push operations will fail on protected branches. Branch protection rules on the remote must be temporarily disabled prior to execution.
Hackathon-Time-Script/
├── main.go # Primary execution script
├── util/
│ ├── clone.go # Repository cloning and log extraction logic
│ ├── run.go # AI model integration and timestamp generation
│ └── edit.go # History rewriting and synchronization procedures
├── edited_commits.txt # Extracted original commit log (Generated)
├── updated_commits.txt # AI-modified commit log (Generated)
├── .env # Environment configuration (Ignored in version control)
├── go.mod # Go module dependencies
└── go.sum # Go module checksums
Review CONTRIBUTING.md for detailed contributor guidelines and procedures. Adherence to the CODE_OF_CONDUCT.md is strictly enforced.
For instructions on disclosing security vulnerabilities, please refer to SECURITY.md.
Distributed under the MIT License. See LICENSE for further details. This project was developed to observe GitHub's visualization of commit histories and the systemic effects of rewritten repositories.