mislav/hub · error
Aborted: %d commits are not yet pushed to %s (use `-f` to fo
Error message
Aborted: %d commits are not yet pushed to %s (use `-f` to force submit a pull request anyway)
What it means
Before submitting a pull request, pullRequest uses git.RefList(trackedBranch.LongName(), "") to count commits on the tracked branch that are not yet on the remote. If there are unpushed commits and -f was not passed, hub aborts with this message telling how many commits are pending and where. This index (38) is the base abort message.
Source
Thrown at commands/pull_request.go:218
}
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) {View on GitHub (pinned to 5c547ed804)
Solutions
- Push the pending commits: git push (or git push -u origin <branch>)
- Pass -f / --force to hub pull-request to submit anyway
- Verify with git log @{u}..HEAD what is unpushed before deciding
Example fix
# before $ git log origin/my-feature..HEAD # 2 commits ahead, then hub pull-request aborts # after $ git push $ hub pull-request
Defensive patterns
Strategy: validation
Validate before calling
branch=$(git rev-parse --abbrev-ref HEAD)
if [ -n "$(git rev-list @{u}..HEAD 2>/dev/null)" ]; then
git push || { echo "Unpushed commits remain"; exit 1; }
fi Prevention
- Run git push before creating PRs
- Check 'git status -sb' ahead/behind counters in CI
- Treat 'N commits are not yet pushed' output as a signal to push, not to bypass with -f
When it happens
Trigger: Running hub pull-request with a tracked upstream branch where git.RefList returns >0 local-only commits, without the --force/-f flag.
Common situations: Amending or adding commits after the last push and forgetting to push; network failures earlier left pushes incomplete; automation created commits locally before PR creation.
Related errors
- %s\n(use `-f` to force submit a pull request anyway)
- could not determine project for head branch
- Aborted: head branch is the same as base ("%s") (use `-h <br
- %s (use `-h <branch>` to specify an explicit pull request he
- Aborted: the current branch seems not yet pushed to a remote
AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01).
Data as JSON: /api/errors/6773998f5c8bb99b.
Report an issue: GitHub.