/git-workflow:gh-pr-create-must-push-errorfrom git-workflow
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.
Ships in git-workflow. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
gh pr create reports:
aborted: you must first push the current branch to a remote, or use the --head flag
even though the branch has just been pushed successfully and git branch -vv
shows correct upstream tracking.
git push -u origin <branch> completed without error moments agogit remote -v shows the expected remotegit branch -vv shows [origin/<branch>] upstream tracking[email protected]:...) — more likely but not requiredgh appears to consult a cache of remote ref state that hasn't refreshed
between the push and the immediate gh pr create call.
Pass --head <branch-name> explicitly:
gh pr create --head fix/my-branch --title "..." --body "..."
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.
The command returns the PR URL (e.g., https://github.com/owner/repo/pull/42)
instead of the abort message.
# Push just succeeded
git push -u origin fix/frontmatter-schema-alignment
# => * [new branch] fix/frontmatter-schema-alignment -> fix/frontmatter-schema-alignment
# Immediate PR create fails
gh pr create --title "feat: ..." --body "..."
# => aborted: you must first push the current branch to a remote, or use the --head flag
# With --head: succeeds
gh pr create --head fix/frontmatter-schema-alignment --title "feat: ..." --body "..."
# => https://github.com/owner/repo/pull/4
git fetch before gh pr create. --head is the fastest and
most reliable.--head also fails with a different error (e.g., "could not determine
base branch"), pass --base main explicitly too.--head as the documented workaroundWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cajias/claude-skills --plugin git-workflow6 skills in this plugin
/gh-pr-merge-in-worktreesRecover from `gh pr merge --delete-branch` appearing to fail inside a git
worktree. Use when: (1) `gh pr merge 2 --delete-branch` prints
`failed to run git: fatal: '<branch>' is already used by worktree at
'<path>'`, (2) you suspect the PR merged anyway despite the error,
(3) you see a merged PR with its remote branch still present on origin,
(4) working in any multi-worktree setup where `main` is checked out in
a sibling worktree. Explains that `gh pr merge --delete-branch` runs
three separable steps (API merge, local delete, remote delete) and the
middle step failing leaves the merge state inconsistent with the
branch-cleanup state.
/git-deadlock-plumbing-recoveryDiagnose and recover git operations that HANG / DEADLOCK at ~0% CPU on macOS
(APFS) — git commit, git reset, git gc/repack, git push, and even git status
never returning. Use when: (1) a git write op "takes forever" / never finishes;
(2) `ps` shows the git process in interruptible sleep (STAT S/SN) with CPU TIME
frozen across samples; (3) a stale 0-byte `.git/index.lock` is present;
(4) `git push` stalls in "Counting objects" / `git repack -ad` hangs with an
empty pack dir; (5) `git count-objects -v` shows thousands of loose objects and
`packs: 0`; (6) the volume is near-full (`df` ~95%+); (7) `.git/index` went
missing after an interrupted git op. Covers the plumbing-commit workaround
(write-tree → commit-tree → update-ref) that bypasses the hanging working-tree
refresh and hooks, index recovery via read-tree, and the real fixes.