{"record":{"id":"650cfc29f39002bb","repo":"mislav/hub","slug":"s-n-use-f-to-force-submit-a-pull-request-anywa","errorCode":null,"errorMessage":"%s\\n(use `-f` to force submit a pull request anyway)","messagePattern":"(.+?)\\\\n\\(use `-f` to force submit a pull request anyway\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pull_request.go","lineNumber":219,"sourceCode":"\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) {\n\t\tremote, _ = localRepo.RemoteForProject(headProject)","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pull_request.go#L201-L237","documentation":"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.","triggerScenarios":"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.","commonSituations":"Same as 38: local commits ahead of the upstream at PR-creation time, commonly after amending a pushed commit or forgetting a final push.","solutions":["git push to publish the pending commits, then retry","Use hub pull-request -f to force submit regardless","Add a pre-submit check (git cherry / git log @{u}..HEAD) in scripts before calling hub"],"exampleFix":"# before\nhub pull-request -m \"msg\"   # aborts with N commits not pushed\n# after\ngit push && hub pull-request -m \"msg\"","handlingStrategy":"validation","validationCode":"[ -z \"$(git rev-list @{u}..HEAD 2>/dev/null)\" ] || git push","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Same as the base error: ensure the branch is fully pushed before hub pull-request","Avoid amending pushed commits without pushing again","Prefer pushing over using -f so reviewers see all commits"],"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"}