cajias/claude-skills/gh-pr-create-must-push-error
Claude Code and agent skill by cajias/claude-skills
- community
Checking that the SKILL.md file is still in the repository.
Fix for "aborted: you must first push the current branch to a remote, or use the --head flag" from `gh pr create` when the branch IS already pushed. Use when: (1) `git push -u origin <branch>` succeeded moments earlier, (2) `git branch -vv` shows upstream tracking is set, (3) `gh pr create` still rejects with the must-push message. Workaround: pass `--head <branch>` explicitly.
Install
npx vskill@latest install cajias/claude-skills/gh-pr-create-must-push-errorSKILL.md
The same SKILL.md was published earlier as cajias/claude-skills/gh-pr-create-must-push-error.
gh pr create "must first push" False Error
Problem
gh pr create reports:
even though the branch has just been pushed successfully and git branch -vv shows correct upstream tracking.
Context / Trigger Conditions
git push -u origin <branch>completed without error moments agogit remote -vshows the expected remotegit branch -vvshows[origin/<branch>]upstream tracking- Remote URL uses SSH (
git@github.com:...) — more likely but not required - Typically seen when pushing a freshly-created branch in the same session
gh appears to consult a cache of remote ref state that hasn't refreshed between the push and the immediate gh pr create call.
Solution
Pass --head <branch-name> explicitly:
This bypasses the stale "is this branch pushed?" check and uses the named branch directly. The PR is created against the default base branch unless --base is also passed.
Verification
The command returns the PR URL (e.g., https://github.com/owner/repo/pull/42) instead of the abort message.
Example
Notes
- Alternative workarounds reported in issues: wait a few seconds and retry,
or run git fetch before gh pr create. --head is the fastest and most reliable.
- This is not the same as the "no commits between" error — that one means
the branch really does match the base. Read the exact error text.
- If
--head_also_ fails with a different error (e.g., "could not determine
base branch"), pass --base main explicitly too.
References
- gh-cli issue #1718 — tracks this
class of race condition, with --head as the documented workaround
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/git-workflow/skills/gh-pr-create-must-push-error/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cajias/claude-skills/gh-pr-create-must-push-error)