Docs
Refer friends. Keep the rewards coming!Your friend can unlock up to 10M tokens · earn up to 30% revenue share.
+500K TokensGenerate link

Git Workflow

CrabCode's built-in git commands: view diffs, branch, draft commit messages, one-shot push + open PR, and read PR comments from the terminal.

What it is

CrabCode wraps the everyday git operations into a set of slash commands. Under the hood it calls your local git and gh (GitHub CLI), but commit messages, PR titles, and PR descriptions are drafted automatically from the current diff — faster than typing by hand, and it follows your repo's existing commit style.

All commands obey a single git safety policy: no touching git config, no destructive operations (push --force / reset --hard / ...) unless you ask explicitly, no skipping hooks, no committing files that look like secrets.

At a glance

CommandWhat it does
/diffView uncommitted changes and per-turn diffs
/branch [name]Branch off at the current conversation point
/commitDraft a commit message and create one commit
/commit-push-prCommit + push + open a PR (or update an existing one)
/pr-commentsView GitHub PR comments inside the terminal
/install-github-appInstall CrabCode's GitHub Actions integration on a repo

/diff — see what changed

Shows uncommitted changes against HEAD plus the diffs of files CrabCode touched in recent turns. Use it right before commit to confirm what you (and it) actually changed.

/branch [name] — branch off

Creates a new branch at the current conversation point. With no argument, CrabCode names it from the recent topic; /branch feature/x pins the name. Conversation context follows the branch — switch back and you can keep the thread.

/commit — smart commit

CrabCode runs git status / git diff HEAD / git log --oneline -10 itself, classifies the change (new feature, fix, refactor, docs, ...), drafts a 1–2 sentence message that follows your repo's commit style (focus on why not what), and creates the commit with heredoc syntax.

Only three git subcommands are allowed: git add / git status / git commit. No push.

If there are no changes, no empty commit is created.

/commit-push-pr — one-shot workflow

All in one go:

  1. If you're on the default branch (auto-detected), create a username/topic branch first
  2. Create the commit (same rules as /commit)
  3. git push -u origin <branch>
  4. Open the PR with gh pr create; title stays short (< 70 chars), details go in the body; the body follows a unified template (Summary + Test plan)
  5. If a PR already exists for this branch, it auto-switches to gh pr edit and updates the title/body instead

The PR URL is echoed at the end.

The allowed surface is wider than /commit: git checkout -b / git push / gh pr create / gh pr edit / gh pr view / gh pr merge. Anything outside the allowlist still goes through the permission prompt.

/pr-comments — PR comments in the terminal

Runs on the current repo's PR (auto-discovers the PR number via gh pr view), pulls both PR-level comments and code review comments, and prints them in @author file:line → diff hunk → comment text → replies format. The diff_hunk from the API is preserved verbatim so you can read the comment in context.

Useful after /review or /ultrareview (see Code Review) — pull reviewer comments back into the conversation and keep iterating.

/install-github-app

Installs CrabCode's GitHub App on the current repo or org, enabling automated PR comments, CI-triggered reviews, etc. Requires repo admin permissions; uses interactive OAuth.

Config: commit attribution

By default CrabCode appends an attribution trailer to commit messages and PR descriptions (noting the commit was produced in collaboration with CrabCode). Customize via settings.json:

json
{
  "attribution": {
    "commit": "Co-Authored-By: CrabCode <crabcode@acosmi.com>",
    "pr": "Generated with CrabCode"
  }
}
{
  "attribution": {
    "commit": "Co-Authored-By: CrabCode <crabcode@acosmi.com>",
    "pr": "Generated with CrabCode"
  }
}
  • attribution.commit — trailer appended to commit messages; an empty string "" disables it entirely
  • attribution.pr — trailer appended to PR descriptions; same rules
  • Field unset → CrabCode's built-in default is used

The legacy includeCoAuthoredBy: false field still works (disables attribution wholesale) but is deprecated; prefer attribution.

Config: skip built-in git instructions

json
{ "includeGitInstructions": false }
{ "includeGitInstructions": false }

Turn this off and CrabCode no longer injects its commit/PR templates into the system prompt. Use it when you want a different commit style, or when CRABCODE.md already pins a custom workflow.

Interplay with Hooks

/commit-push-pr triggers PreToolUse(Bash(git push:*)) when it reaches the push step. You can use the hook to:

  • Block pushes to main / master (return decision: block)
  • Force a local test run before letting it through
  • Forward the push event to an internal audit pipeline

See Hooks.

Worktrees and attribution

If you use git worktree heavily for parallel work, note that commits are per-worktree but the attribution.commit field lives in global settings.json — it is not scoped per worktree.

  • HooksPreToolUse intercepts pushes
  • CrabCode on the web/ultrareview runs deep review in the cloud
  • Code Review/review / /ultrareview / /security-review
  • Settingsattribution / includeGitInstructions fields