-
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add /commit-push-pr slash command #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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