Claude Code integrates seamlessly with Git and GitHub. Power users leverage this to automate everything from code review to commits to PR creation.
ykdojo built powerful workflows by combining Git and GitHub CLI (gh) with Claude Code.
"Analyze the changes, write an appropriate commit message, and commit it."
# Claude:
# analyzes git diff
# generates a commit message: "feat: Add user authentication middleware with JWT validation"
# runs: git add . && git commit -m "..."
"Create a draft PR from the current branch. Use a title summarizing the changes and list the key changes in the body."
# Claude:
# gh pr create --draft --title "..." --body "..."
If you create .github/pull_request_template.md, Claude can use it to fill in PR bodies.
## Changes
-
## How to test
-
## Checklist
- [ ] Tests added
- [ ] Docs updated
- [ ] No breaking changes
When you need to work on multiple branches at the same time, git worktree lets you avoid switching branches and work in parallel.
A feature that lets you create multiple working directories in a single repository, each checked out to a different branch.
How to use:
# Create a worktree
> "Use git worktree to check out feature/auth into ../myapp-feature-auth"
# Claude:
# git worktree add ../myapp-feature-auth feature/auth
Workflow example:
~/projects/myapp-feature-auth~/projects/myapp-hotfix~/projects/myappykdojo's advice:
"Worktrees remove context-switching cost. You don't need to reinstall node_modules or rebuild every time you switch branches."
Claude Code is more than a code generator: it can be a strong code reviewer.
PR review workflow:
# 1. Check out a PR
> "Run gh pr checkout 123 and summarize the changes"
# 2. Get a high-level overview
> "Explain what problem this PR solves and what the main changed files are"
# 3. Deep review per file
> "Analyze the changes in src/auth/middleware.ts.
Check for security issues or performance problems"
# 4. Test coverage
> "Evaluate whether tests are sufficient for these changes"
# 5. Improvement suggestions
> "Is there a more efficient way to implement this logic?"
# 6. Auto-apply improvements
> "Apply the improvements you suggested and run tests"
Claude Code can auto-approve repetitive commands, but this can be risky.
ykdojo built cc-safe to scan .claude/settings.json and detect risky approved commands.
Install and run:
# install
npm install -g cc-safe
# scan current directory
npx cc-safe .
# scan an entire projects directory
npx cc-safe ~/projects
Risk patterns it detects:
sudo, rm -rf, chmod 777
curl | sh, wget | bash
git reset --hard, git push --force
npm publish, docker run --privileged
ykdojo's advice:
"Run cc-safe once a month to audit approved commands."