Skip to main content

Command Palette

Search for a command to run...

Using Claude Code to write better git commit messages

Updated
1 min readView as Markdown
H

I build systems that blend AI and automation to solve real-world problems

i am really bad at writing git commit messages. most of my messuages would be a 1,2,3 or “save“. As long as you are working solo on projects, this is fine. But working on git repos with multiple people on it are going you a tongue wagging.

I hate it so much so that I once wrote a whole tool 2 years back to use gpt-3 to write commit messages for me.

But now I have found an easier & better way.

I delegate the work of writing a good git commit message to claude code.

git diff | claude -p --model haiku "Summarize the changes in this git diff output."

or if you have already staged the changes, then…

git diff --staged | claude -p --model haiku "Generate a concise commit message summarizing the changes in this git diff output."

of if you want to save it to a file first…

git diff --staged | claude -p --model haiku "Generate a concise commit message summarizing the changes in this git diff output." > commit_message.txt

If you noticed, i am passing the —model option with “haiku“ so that it doesn’t uses lot of higher cost sonnet or opus tokens. you could use whatever you want. But I have found “haiku“ to be pretty good at this simple job.

Claude Code Adventures

Part 1 of 1

My experience with using Claude Code for my day to day work.

More from this blog

Harish Garg | AI Automation & Agentic CLI Consulting

119 posts

Agentic CLI consulting for startups and teams. Claude Code, Gemini CLI, and Rovo Dev in practice. Playbooks, checklists, and real workflows. Contact: [email protected]