mislav/hub · error

Aborted: the current branch seems not yet pushed to a remote

Error message

Aborted: the current branch seems not yet pushed to a remote
(use `-p` to push the branch or `-f` to skip this check)

What it means

When the current branch has no upstream (trackedBranch == nil) and neither -f (force) nor -p (push) was given, pullRequest checks whether the branch exists on any remote. If the branch was never pushed, it aborts with this message, appending the hint to use -p to push or -f to skip. This index (36) is the base 'Aborted' message path.

Source

Thrown at commands/pull_request.go:195

			if baseProject.SameAs(headProject) && base == trackedBranch.ShortName() {
				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. Push the branch first: git push -u origin <branch>
  2. Run hub pull-request -p to let hub push the branch before creating the PR
  3. Use -f to skip the unpushed-branch check if you are sure the branch exists remotely

Example fix

# before
$ git checkout -b my-feature && hub pull-request
Aborted: the current branch seems not yet pushed to a remote
# after
$ hub pull-request -p   # or: git push -u origin my-feature first
Defensive patterns

Strategy: validation

Validate before calling

branch=$(git rev-parse --abbrev-ref HEAD)
git ls-remote --heads origin "$branch" | grep -q . || { echo "Branch $branch not pushed; run git push -u origin $branch"; exit 1; }

Prevention

When it happens

Trigger: Creating a pull request from a purely local branch: branchTrackingInformation fails or indicates the branch tracks the base remote/branch, and localRepo.RemoteForBranch returns nil, all without --force/--push flags.

Common situations: Committing on a new feature branch and immediately running hub pull-request before ever pushing; CI checkouts that create branches locally without pushing.

Related errors


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