Git Mentions
Git mentions let you bring your repository’s history and changes directly into your conversation with Cline. You can reference uncommitted changes with @git-changes
or specific commits with @[commit-hash]
.
When you type @
in chat, you can select “Git Changes” from the menu or type @git-changes
directly. For specific commits, type @
followed by the commit hash (at least 7 characters). Cline will immediately see the git status, diffs, commit messages, and other relevant information.
I use git mentions constantly when I’m trying to understand code changes or troubleshoot issues introduced by recent commits. Instead of trying to copy and paste diffs or commit logs, I just ask:
This gives Cline the complete commit information, including the commit message, author, date, and the full diff. Cline can then analyze exactly what changed and how it might affect other parts of the codebase.
The @git-changes
mention is perfect when you’re working on changes and want feedback before committing:
This shows Cline all your uncommitted changes, including new files, modified files, and their diffs. Cline can then review your changes and provide feedback on your implementation.
Git mentions are especially powerful when combined with file mentions. When I’m investigating a bug, I’ll often reference both:
Next time you’re working with code changes or investigating issues, try using git mentions instead of manually describing or copying changes. You’ll get more accurate help because Cline can see exactly what changed and in what context.
How It Works Under the Hood
When you use git mentions in your message, here’s what happens behind the scenes:
For Git Changes (@git-changes
)
-
When you send your message, Cline detects the
@git-changes
pattern in your text -
The extension runs git commands to get the current working state of your repository
-
It captures the output of
git status
andgit diff
to see all uncommitted changes -
This information is appended to your message in a structured format:
For Specific Commits (@[commit-hash]
)
-
When you send your message, Cline detects the
@
followed by a commit hash pattern -
The extension runs
git show
and related commands to get information about that commit -
It retrieves the commit message, author, date, and the complete diff
-
This information is appended to your message in a structured format:
This process happens automatically whenever you use git mentions, giving the AI complete visibility into your code changes without you having to copy and paste diffs or commit logs.