{"record":{"id":"1799d7c86c603444","repo":"mislav/hub","slug":"aborted-no-commits-detected-between-s-and-s","errorCode":null,"errorMessage":"Aborted: no commits detected between %s and %s","messagePattern":"Aborted: no commits detected between (.+?) and (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pull_request.go","lineNumber":269,"sourceCode":"\n\tflagPullRequestMessage := args.Flag.AllValues(\"--message\")\n\tflagPullRequestEdit := args.Flag.Bool(\"--edit\")\n\tflagPullRequestIssue := args.Flag.Value(\"--issue\")\n\tif !args.Flag.HasReceived(\"--issue\") && args.ParamsSize() > 0 {\n\t\tflagPullRequestIssue = parsePullRequestIssueNumber(args.GetParam(0))\n\t}\n\n\tif len(flagPullRequestMessage) > 0 {\n\t\tmessageBuilder.Message = strings.Join(flagPullRequestMessage, \"\\n\\n\")\n\t\tmessageBuilder.Edit = flagPullRequestEdit\n\t} else if args.Flag.HasReceived(\"--file\") {\n\t\tmessageBuilder.Message, err = msgFromFile(args.Flag.Value(\"--file\"))\n\t\tutils.Check(err)\n\t\tmessageBuilder.Edit = flagPullRequestEdit\n\t} else if args.Flag.Bool(\"--no-edit\") {\n\t\tcommits, _ := git.RefList(baseTracking, head)\n\t\tif len(commits) == 0 {\n\t\t\tutils.Check(fmt.Errorf(\"Aborted: no commits detected between %s and %s\", baseTracking, head))\n\t\t}\n\t\tmessage, err := git.Show(commits[len(commits)-1])\n\t\tutils.Check(err)\n\t\tmessageBuilder.Message = message\n\t} else if flagPullRequestIssue == \"\" {\n\t\tmessageBuilder.Edit = true\n\n\t\theadForMessage := headTracking\n\t\tif flagPullRequestPush {\n\t\t\theadForMessage = head\n\t\t}\n\n\t\tmessage := \"\"\n\n\t\tcommits, _ := git.RefList(baseTracking, headForMessage)\n\t\tif len(commits) == 1 {\n\t\t\tmessage, err = git.Show(commits[0])\n\t\t\tutils.Check(err)","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pull_request.go#L251-L287","documentation":"With `--no-edit`, gh skips the interactive editor and derives the PR title/body from the commit log between baseTracking and head. If `git.RefList` finds zero commits in that range, there is no source text for the PR, so it aborts with this error instead of opening an empty PR.","triggerScenarios":"`gh pr create --no-edit` where `git.RefList(baseTracking, head)` returns no commits — the head branch has no commits ahead of the base branch (or the ref names resolve to nothing).","commonSituations":"Creating a PR from a branch that is already merged or identical to base; typo'd base branch name; user assumed --no-edit would reuse a previous PR description; forgetting to commit before creating the PR.","solutions":["Commit changes on the head branch so at least one commit exists between base and head, then rerun with --no-edit.","Run `gh pr create` without --no-edit and write the title/body in the editor.","Verify the range with `git log <base>..<head>` and check the base branch spelling (`--base <branch>`)."],"exampleFix":"// before\ngh pr create --base main --no-edit   # no commits ahead of main\n// after\ngit commit -m \"Add feature\"\ngh pr create --base main --no-edit","handlingStrategy":"validation","validationCode":"commits, err := git.RefList(base, head)\nif err != nil || len(commits) == 0 {\n    return fmt.Errorf(\"no commits between %s and %s; commit changes or drop --no-edit\", base, head)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `git log <base>..<head>` is non-empty before `pr create --no-edit`.","Commit work before opening the PR.","Verify the base branch name exists."],"tags":["git","pull-request","cli","validation"],"backgroundTag":"empty-commit-range","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}