Conversation
Add a new slash command that automates the workflow of: - Creating a branch if on main - Committing changes with an appropriate message - Pushing to origin - Creating a pull request Source: https://github.com/anthropics/claude-code/blob/main/.claude/commands/commit-push-pr.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
| allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*), Bash(git push:*), Bash(git commit:*), Bash(gh pr create:*) | ||
| description: Commit, push, and open a PR | ||
| --- | ||
|
|
||
| <!-- Source: https://github.com/anthropics/claude-code/blob/main/.claude/commands/commit-push-pr.md --> | ||
|
|
||
| ## Context | ||
|
|
||
| - Current git status: !`git status` | ||
| - Current git diff (staged and unstaged changes): !`git diff HEAD` |
There was a problem hiding this comment.
Bug: The allowed-tools specification for the commit-push-pr command uses the invalid git flag git checkout --branch, which will cause the command to fail.
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
The .claude/commands/commit-push-pr.md file specifies allowed-tools: Bash(git checkout --branch:*). The --branch flag is not a valid option for the git checkout command; the correct flag to create a new branch is -b. When the command is invoked, it will attempt to execute git checkout --branch <branchname>, which will fail with a git error about an unrecognized flag. This failure at the first step prevents the entire workflow of creating a branch and pull request from completing.
💡 Suggested Fix
In the allowed-tools section of .claude/commands/commit-push-pr.md, replace the invalid git checkout --branch:* with the correct syntax, git checkout -b *. This will allow the tool to correctly create new branches as intended.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: .claude/commands/commit-push-pr.md#L2-L11
Potential issue: The `.claude/commands/commit-push-pr.md` file specifies `allowed-tools:
Bash(git checkout --branch:*)`. The `--branch` flag is not a valid option for the `git
checkout` command; the correct flag to create a new branch is `-b`. When the command is
invoked, it will attempt to execute `git checkout --branch <branchname>`, which will
fail with a git error about an unrecognized flag. This failure at the first step
prevents the entire workflow of creating a branch and pull request from completing.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 6872053
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #518 +/- ##
=======================================
Coverage 80.92% 80.92%
=======================================
Files 164 164
Lines 14248 14248
Branches 1505 1505
=======================================
Hits 11530 11530
Misses 2148 2148
Partials 570 570 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Add a new slash command that automates the workflow of creating a branch, committing changes, pushing to origin, and creating a pull request.
Source: https://github.com/anthropics/claude-code/blob/main/.claude/commands/commit-push-pr.md
🤖 Generated with Claude Code