STRUCTURED

Claude Code Skill (Slash Command): push-and-pull-request.md

Contributed by DoguD

Improved by Laravel Company · 2026-09-07

Detailed Instructions for Git Commit and PR Creation

Current Status Overview

  • Current branch: !git branch --show-current
  • Uncommitted changes (git status):
    php
    !`git status`
  • Staged and unstaged changes (git diff):
    php
    !`git diff HEAD`
  • Recent commit history (10 most recent):
    php
    !`git log --oneline -10`

Step-by-step Process

Step 1: Review Changes and Create Git Commits

Review the changes: Carefully examine the output of git diff HEAD to identify distinct, logical changes that should be committed separately. Each change should represent a single, atomic unit of work.

Commit format: Follow the conventional commit format for your project. Typically, this is feat: <subject> for new features, fix: <subject> for bug fixes, and refactor: <subject> for code refactoring. The subject should be a concise, imperative verb followed by a description of the change.

Multiple commits: If you find more than one logical change, create separate commits for each. Use descriptive commit messages that clearly explain what each change accomplishes.

Example:

php
# git commit -m "feat: Add new user authentication API"
# git commit -m "fix: Resolve memory leak in user service"

Step 2: Push All Commits

  • Verify that all desired commits are staged using git status.
  • If any changes are not staged, use git add <file_path> to stage them.
  • Once all changes are staged, push them to the remote repository using:
    shell
    git push origin <your-branch-name>

Step 3: Open a PR to Main

  • After pushing, open a pull request (PR) to the main branch.
  • PR title: Start with a capital letter and follow the conventional PR title format of your project (e.g., "Feature: Add new user authentication API").
  • PR description: Provide a detailed description of the changes, including:
    • The purpose of the PR
    • What problems it solves
    • Any relevant context or background
    • Clear instructions for reviewers, if necessary
  • PR options:
    • Select the target branch as main
    • Choose the appropriate reviewers (usually the team maintaining the main branch)
    • Set the PR title and description as specified above
    • Click "Create pull request" to open it

Command (if using GitHub CLI):

php
gh pr create --base main --head <your-branch-name> --title "<PR-title>" --body "<PR-description>"

Deliverable

Provide the exact commands used for each step, including any output or error messages, to ensure the process is transparent and reproducible.

Original prompt (before our improvements)

--- allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git push:*), Bash(gh pr create:*) description: Commit and push everything then open a PR request to main --- ## Context - Current git status: !`git status` - Current git diff (staged and unstaged changes): !`git diff HEAD` - Current branch: !`git branch --show-current` - Recent commits: !`git log --oneline -10` ## Your task 1. Review the existing changes and then create a git commit following the conventional commit format. If you think there are more than one distinct change you can create multiple commits. If there are no outstanding changes proceed to 2. 2. Push all commits. 3. Open a PR to main following the conventional formats.