mislav/hub · error

\n(use `-f` to force submit a pull request anyway)

Error message

%s\n(use `-f` to force submit a pull request anyway)

What it means

The wrapped second error of the unpushed-commits abort: hub wraps the 'Aborted: %d commits are not yet pushed to %s' error with the hint line "(use `-f` to force submit a pull request anyway)" and passes it to utils.Check, so the printed message ends with this guidance.

Solutions

  1. git push to publish the pending commits, then retry
  2. Use hub pull-request -f to force submit regardless
  3. Add a pre-submit check (git cherry / git log @{u}..HEAD) in scripts before calling hub

Example fix

# before
hub pull-request -m "msg"   # aborts with N commits not pushed
# after
git push && hub pull-request -m "msg"
Defensive patterns

Strategy: validation

Validate before calling

[ -z "$(git rev-list @{u}..HEAD 2>/dev/null)" ] || git push

Prevention

When it happens

Trigger: Same as error 38 — trackedBranch exists, git.RefList(trackedBranch.LongName(), "") returns at least one commit, and no -f flag — producing the multi-line message ending in this hint.

Common situations: Same as 38: local commits ahead of the upstream at PR-creation time, commonly after amending a pushed commit or forgetting a final push.

Related errors


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

Appendix: source

Thrown at commands/pull_request.go:219

			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)

	if !force && trackedBranch != nil {
		remoteCommits, err := git.RefList(trackedBranch.LongName(), "")
		if err == nil && len(remoteCommits) > 0 {
			err = fmt.Errorf("Aborted: %d commits are not yet pushed to %s", len(remoteCommits), trackedBranch.LongName())
			err = fmt.Errorf("%s\n(use `-f` to force submit a pull request anyway)", err)
			utils.Check(err)
		}
	}

	messageBuilder := &github.MessageBuilder{
		Filename: "PULLREQ_EDITMSG",
		Title:    "pull request",
	}

	baseTracking := base
	headTracking := head

	remote := baseRemote
	if remote != nil {
		baseTracking = fmt.Sprintf("%s/%s", remote.Name, base)
	}
	if remote == nil || !baseProject.SameAs(headProject) {
		remote, _ = localRepo.RemoteForProject(headProject)

View on GitHub (pinned to 5c547ed804)