Rewrite Git Commit Messages to Improve Clarity with commit-rewriter
Job to be done: Rewrite Git commit messages to improve clarity and remove sensitive information
🇳🇬 Ways to use this in Nigeria
Ideas to get you started, adapt to your situation.
- Student
Before submitting your final year project or a group coding assignment, clean up messy Git commit messages, remove internal notes, or AI-generated filler to present a professional project history.
- 9-5 employee
Before pushing your feature branch to the main repository or submitting a pull request, clean up your Git commit messages, removing internal project codes or AI-generated filler, to meet team coding standards.
- Entrepreneur
Before open-sourcing a component of your startup's product or sharing a repository with potential investors, remove internal issue IDs and AI-generated 'cruft' from your commit history.
What you’ll get
This workflow helps you clean up your Git commit messages, removing sensitive information, private issue IDs, or unnecessary details (often called ‘cruft’) from AI-generated code. You will get a Git repository with a clear, publishable history, while the tool automatically creates a backup of your original commits.
Tools you need
- Git (free): The version control system used to track changes in your code and files.
- Python (free): The programming language runtime needed to run the commit-rewriter tool.
- uvx (free): A fast tool for running Python packages directly from the command line without needing to install them globally.
- commit-rewriter (free): A small web application that helps you edit Git commit messages interactively.
Steps
-
Install Git and Python: First, ensure you have Git and Python installed on your computer. You can download Git from its official website and Python from python.org. Follow their installation instructions for your operating system.
- You should have Git and Python available from your command line.
-
Open your terminal: A terminal (also called a command line or shell) is a text-based interface for your computer. On Windows, search for “Command Prompt” or “PowerShell.” On macOS, search for “Terminal.” On Linux, it’s usually called “Terminal.”
- You should see a command-line window open, ready for you to type commands.
-
Navigate to your Git repository: Use the
cdcommand (change directory) to go into the folder of the Git repository you want to edit. Replacepath/to/your/repowith the actual path to your project folder.# macOS or Linux cd path/to/your/repo# Windows (PowerShell) Set-Location -Path "path/to/your/repo"- Your terminal prompt should now show that you are inside your project’s folder.
-
Run the commit-rewriter tool: Execute the
uvxcommand to start the commit-rewriter web application. The.tells the tool to look for the Git repository in your current folder.uvx commit-rewriter .- A new tab or window should automatically open in your web browser, displaying the commit-rewriter interface with a list of your repository’s commits.
-
Edit your commit messages: In the web interface, you will see your commit history. For each commit, you can edit its message in a text field. Focus on removing any sensitive information (like internal issue IDs), AI agent ‘cruft’ (unnecessary or repetitive text generated by AI), or anything that makes the message unclear. Aim for clear, concise, and public-friendly descriptions.
- You should have made all your desired changes to the commit messages within the web interface.
-
Submit your changes: Look for a “Submit” or “Apply” button in the web interface and click it. The tool will then process your edits.
- The tool will confirm that the changes have been applied. It automatically creates a new timestamped branch (e.g.,
commit-rewriter-backup-YYYYMMDD-HHMMSS) containing your repository’s state before the rewrite. Then, it rewrites the commit messages on your current branch from the first commit you edited to the most recent one.
- The tool will confirm that the changes have been applied. It automatically creates a new timestamped branch (e.g.,
-
Verify the rewritten history (optional): You can check your updated commit messages by running a Git log command in your terminal.
git log --oneline- You should see your updated, cleaner commit messages listed in the terminal output.
Original source
This workflow is based on the commit-rewriter tool, released by Simon Willison on his blog on September 14, 2026. He developed it to clean up commit messages for Datasette security releases, removing internal references and AI-generated text.
Notes & variations
- Common Pitfall: While
commit-rewritercreates a backup branch automatically, remember that rewriting Git history can be disruptive, especially if you’ve already pushed these commits to a shared remote repository. It’s generally best to use this tool on commits that haven’t been shared yet, or to coordinate with your team if they have. - Tip for Better Results: When editing, focus on making each commit message a concise summary of the changes introduced in that specific commit. Good commit messages are short, descriptive, and explain why a change was made, not just what was changed.
- Reverting Changes: If you are not satisfied with the rewritten history, you can always switch back to the backup branch that
commit-rewritercreated. The branch name will be something likecommit-rewriter-backup-YYYYMMDD-HHMMSS.