Commit History Cleanup
Refactor and clean up commit history to improve code documentation, readability, and maintainability. This loop focuses on squashing redundant commits, rewriting unclear messages, and ensuring a logical progression of changes.
Goal
Improve commit history
How to Run
Run this loop in your coding agent to iteratively refine and enhance your Git commit history.
- 01
Initiate Loop
Start the loop by providing the kickoff prompt to your agent.
- 02
Review Current History
The agent will analyze the current commit history and identify areas for improvement.
- 03
Propose Changes
Based on the review, the agent will suggest specific improvements like squashing or rewording commits.
- 04
Apply Improvements
The agent will implement the suggested changes using appropriate Git commands.
- 05
Verify Result
After each iteration, the agent will check if the commit history meets the exit condition.
Workflow Steps
- 01
Analyze History
Use 'git log' to examine commit messages, structure, and redundancy.
- 02
Identify Issues
Flag commits with unclear messages, excessive splitting, or logical inconsistencies.
- 03
Suggest Changes
Recommend specific actions like squashing, rewording, or reordering commits.
- 04
Execute Commands
Apply Git commands such as 'rebase -i' to implement proposed changes.
- 05
Validate Output
Confirm that the revised history improves clarity and meets project standards.
Kickoff Prompt
Start the "Commit History Cleanup" loop. Goal: Improve commit history Max iterations: 10 Between iterations run: history review Exit when: History approved Please review the current Git commit history for this project. Identify any commits with unclear messages, redundant changes, or poor structure. Suggest improvements to create a cleaner, more logical history. Prioritize squashing fixup commits and rewording vague messages. Self-pace this loop. After each iteration, run `history review` and evaluate the output, and only continue if the exit condition is not met (History approved). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Only modify commits reachable from the current branch HEAD.
- ·Never rewrite public/shared history without explicit confirmation.
- ·Preserve all changes in commits; only restructure or reword as needed.
- ·Limit squashing/fixup operations to the last 10 commits to minimize risk.
- ·Ensure no merge commits are involved in the cleanup process.
Flow Diagram
Related loops — Git
Git
Conventional Commit Enforcer
This loop ensures all Git commits follow the Conventional Commits specification by using commitlint to validate commit messages. It automatically detects non-compliant commits, suggests fixes, and guides the user through correcting them until all commits pass validation.
Git
Large Commit Splitter
Automatically splits large, monolithic Git commits into smaller, more reviewable units while preserving logical code boundaries and maintaining clean history.
Git
Git Hygiene Loop
This loop helps maintain a clean Git repository by identifying and removing stale or outdated branches that are no longer needed. It ensures your branch list remains manageable and reduces clutter in collaborative environments.