{"record":{"id":"6773998f5c8bb99b","repo":"mislav/hub","slug":"aborted-d-commits-are-not-yet-pushed-to-s-use","errorCode":null,"errorMessage":"Aborted: %d commits are not yet pushed to %s\n(use `-f` to force submit a pull request anyway)","messagePattern":"Aborted: (.+?) commits are not yet pushed to (.+?)\n\\(use `-f` to force submit a pull request anyway\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pull_request.go","lineNumber":218,"sourceCode":"\t\t\t}\n\t\t\thead = currentBranch.ShortName()\n\t\t} else {\n\t\t\thead = trackedBranch.ShortName()\n\t\t}\n\t}\n\n\tif headRepo, err := client.Repository(headProject); err == nil {\n\t\theadProject.Owner = headRepo.Owner.Login\n\t\theadProject.Name = headRepo.Name\n\t}\n\n\tfullBase := fmt.Sprintf(\"%s:%s\", baseProject.Owner, base)\n\tfullHead := fmt.Sprintf(\"%s:%s\", headProject.Owner, head)\n\n\tif !force && trackedBranch != nil {\n\t\tremoteCommits, err := git.RefList(trackedBranch.LongName(), \"\")\n\t\tif err == nil && len(remoteCommits) > 0 {\n\t\t\terr = fmt.Errorf(\"Aborted: %d commits are not yet pushed to %s\", len(remoteCommits), trackedBranch.LongName())\n\t\t\terr = fmt.Errorf(\"%s\\n(use `-f` to force submit a pull request anyway)\", err)\n\t\t\tutils.Check(err)\n\t\t}\n\t}\n\n\tmessageBuilder := &github.MessageBuilder{\n\t\tFilename: \"PULLREQ_EDITMSG\",\n\t\tTitle:    \"pull request\",\n\t}\n\n\tbaseTracking := base\n\theadTracking := head\n\n\tremote := baseRemote\n\tif remote != nil {\n\t\tbaseTracking = fmt.Sprintf(\"%s/%s\", remote.Name, base)\n\t}\n\tif remote == nil || !baseProject.SameAs(headProject) {","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pull_request.go#L200-L236","documentation":"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.","triggerScenarios":"Running hub pull-request with a tracked upstream branch where git.RefList returns >0 local-only commits, without the --force/-f flag.","commonSituations":"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.","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"],"exampleFix":"# before\n$ git log origin/my-feature..HEAD  # 2 commits ahead, then hub pull-request aborts\n# after\n$ git push\n$ hub pull-request","handlingStrategy":"validation","validationCode":"branch=$(git rev-parse --abbrev-ref HEAD)\nif [ -n \"$(git rev-list @{u}..HEAD 2>/dev/null)\" ]; then\n  git push || { echo \"Unpushed commits remain\"; exit 1; }\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["git","pull-request","unpushed-commits","hub-cli"],"backgroundTag":"commits-not-pushed","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}