mislav/hub · error

%s (use `-p` to push the branch or `-f` to skip this check)

Error message

%s
(use `-p` to push the branch or `-f` to skip this check)

What it means

The wrapped form of the 'not yet pushed to a remote' abort in pullRequest: after building the base error, hub wraps it with fmt.Errorf("%s\n(use `-p` to push the branch or `-f` to skip this check)") and calls utils.Check. This index records that wrapping error with the hint suffix.

Source

Thrown at commands/pull_request.go:196

				e := fmt.Errorf(`Aborted: head branch is the same as base ("%s")`, base)
				e = fmt.Errorf("%s\n(use `-h <branch>` to specify an explicit pull request head)", e)
				utils.Check(e)
			}
		}
	}

	force := args.Flag.Bool("--force")
	flagPullRequestPush := args.Flag.Bool("--push")

	if head == "" {
		if trackedBranch == nil {
			utils.Check(currentBranchErr)
			if !force && !flagPullRequestPush {
				branchRemote, branchMerge, err := branchTrackingInformation(currentBranch)
				if err != nil || (baseRemote != nil && branchRemote == baseRemote.Name && branchMerge.ShortName() == base) {
					if localRepo.RemoteForBranch(currentBranch, host.User) == nil {
						err = fmt.Errorf("Aborted: the current branch seems not yet pushed to a remote")
						err = fmt.Errorf("%s\n(use `-p` to push the branch or `-f` to skip this check)", err)
						utils.Check(err)
					}
				}
			}
			head = currentBranch.ShortName()
		} else {
			head = trackedBranch.ShortName()
		}
	}

	if headRepo, err := client.Repository(headProject); err == nil {
		headProject.Owner = headRepo.Owner.Login
		headProject.Name = headRepo.Name
	}

	fullBase := fmt.Sprintf("%s:%s", baseProject.Owner, base)
	fullHead := fmt.Sprintf("%s:%s", headProject.Owner, head)

View on GitHub (pinned to 5c547ed804)

Solutions

  1. git push -u origin <branch> before hub pull-request
  2. Add -p to the hub pull-request command to auto-push
  3. Add -f to bypass the check

Example fix

# before
hub pull-request -m "msg"
# after
hub pull-request -m "msg" -p
Defensive patterns

Strategy: validation

Validate before calling

branch=$(git rev-parse --abbrev-ref HEAD)
git ls-remote --heads origin "$branch" | grep -q . || { git push -u origin "$branch"; }

Prevention

When it happens

Trigger: Exactly the same conditions as error 36 — local-only branch, no -p/-f flags — seen as the second line of the printed message.

Common situations: Same as 36: forgetting to push a new feature branch before opening a PR.

Related errors


AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01). Data as JSON: /api/errors/8af42ade661f182b. Report an issue: GitHub.