Skip to content

git -C /path <subcommand> not rewritten to rtk git #2303

Closed

Description

@Edge4711

Problem

RTK's hook correctly rewrites git <subcommand> → rtk git <subcommand>, but misses the git -C /path <subcommand> form (where -C sets the working directory inline).

This pattern is common in multi-worktree setups and is the recommended style in Claude Code to avoid a permission system bypass (Claude Code bug #59498 — cd /path && git bypasses deny rules entirely, allowing subagents to push/reset without prompting). Users following this best practice end up with all their git commands unhandled by RTK.

Example

# Rewritten correctly:
git status → rtk git status

# Not rewritten (passes through unfiltered):
git -C /Users/paul/MyData/Code/FinancialPlatform status
git -C /Users/paul/MyData/Code/FinancialPlatform/.worktrees/feature/foo log --oneline -10

Request

Treat git -C <path> <subcommand> the same as git <subcommand> in the hook rewriter — strip the -C <path> for routing purposes and pass it through to the underlying rtk git handler.

Volume

rtk discover shows 119 unhandled git -C calls in 30 days for a single project. Since this is the recommended Claude Code pattern, likely affects many users.

Activity

  1. added
    bug
    help wanted
    on Jun 7, 2026
  2. pszymkowiak commented on Jun 7, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 92%

    Summary

    RTK hook fails to rewrite git -C <path> <subcommand> form, causing 119+ unhandled calls/month per project; fix requires updating the hook rewriter to recognize the -C flag pattern.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. KuSh commented on Nov 8, 2026

    @KuSh
    Collaborator

    On v1.2.0 both git -C <path> ... commands from your report are rewritten to rtk git -C ... and run correctly. Support for git -C was added in v0.30.0 (#555), which predates your report, so the change that made the difference for your setup could not be pinned down. Marking it resolved-pending-close: it will be closed in a while unless you still see git -C commands left unrewritten on the latest version. A quoted path that contains spaces is still not rewritten; if that is your case, please say so here.

  4. added
    resolved-pending-close
    on Nov 8, 2026
  5. KuSh commented on Nov 15, 2026

    @KuSh
    Collaborator

    No new report since the 8 November note, so closing it as described there. Both git -C <path> ... commands from the report are rewritten to rtk git -C ... on v1.2.0 (support came in #555, v0.30.0); a quoted path that contains spaces is still not rewritten. If you still see plain git -C commands go unrewritten on v1.2.0 or later, please comment with the exact command and it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clibughelp wantedpriority:highresolved-pending-close

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions