gh-pr-create-must-push-error

Create GitHub pull requests with gh pr create using explicit --head branch flags.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/cajias/claude-skills --skill gh-pr-create-must-push-error
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gh-pr-create-must-push-error
Source: https://github.com/cajias/claude-skills/tree/main/plugins/git-workflow/skills/gh-pr-create-must-push-error
Command: npx skills add https://github.com/cajias/claude-skills --skill gh-pr-create-must-push-error

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves the frustrating case where gh pr create claims you must push the current branch even though the branch was already pushed and upstream tracking is correct.

Core Features & Use Cases

  • Diagnoses the stale-state error: Identifies when GitHub CLI is likely reading outdated remote branch state instead of the current local tracking information.
  • Provides the reliable workaround: Instructs you to pass the branch explicitly with --head so gh pr create can create the pull request without relying on the stale check.
  • Handles common follow-up cases: Notes when --base may also be needed and distinguishes this error from the separate "no commits between" condition.

Quick Start

Tell Claude to create the pull request with gh pr create using the branch name explicitly in the --head flag.

Frequently Asked Questions about gh-pr-create-must-push-error

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does gh pr create say I must push the current branch right after pushing?

The gh pr create branch push error happens because GitHub CLI reads stale remote ref state instead of current local tracking data, causing cached branch-state validation to fail and reject pull request creation even when upstream tracking is correct.

How do I fix gh pr create failing to recognize a pushed branch?

To fix gh pr create failing to recognize a pushed branch, explicitly pass the branch name using the --head flag to bypass the stale remote state check and force GitHub CLI to create the pull request directly.

What is the difference between the gh pr create push false error and the no commits between error?

The gh pr create push false error involves stale remote ref state preventing branch detection, while the no commits between error indicates an actual absence of code changes between the head and base branches requiring the --head workaround.

Do I need to pass --base when fixing the gh pr create branch tracking error?

Passing --base is optional when fixing the gh pr create branch tracking error. The --head flag is required to bypass the stale check, but --base may also be needed to specify the target branch if default detection fails.

Can stale remote ref state break GitHub CLI pull request creation on any branch?

Stale remote ref state breaks GitHub CLI pull request creation primarily on new branches pushed immediately before running gh pr create. The cached validation fails to read the updated remote state, requiring the --head flag to bypass the check.