Tips
ClaudeCursor
Foundations
Git Workflows with AI
Use AI agents to review diffs, write commits, and manage branches
43 of 66
Review changes before committing
# Claude Code: pipe diff for review git diff | claude -p "review these changes for bugs and style issues" # Or inside a session "Review my uncommitted changes and flag any issues"
In Cursor, use @git in chat to reference recent changes.
Write commit messages
# Let Claude craft a commit message from staged changes git diff --staged | claude -p "write a conventional commit message" --output-format text
Or create a slash command at .claude/commands/commit.md:
Review git diff --staged and write a Conventional Commits message. Follow the format: type(scope): description
Branch management
Ask the agent to help with branch operations:
"Create a feature branch from main for the user-auth work" "Show me what is different between this branch and main" "Help me resolve the merge conflicts in src/auth.ts"
Tips
- Stage specific files before asking for commit messages (smaller diff = better message)
- Use
-pmode for quick git operations to avoid starting a full session - Both tools can run git commands directly, just ask