{"record":{"id":"7c348e3622c33c59","repo":"jesseduffield/lazygit","slug":"cannot-start-interactive-rebase-the-head-commit-i","errorCode":null,"errorMessage":"Cannot start interactive rebase: the HEAD commit is a merge commit or is present on the main branch, so there is no appropriate base commit to start the rebase from. You can start an interactive rebase from a specific commit by selecting the commit and pressing `{{.editKey}}`.","messagePattern":"Cannot start interactive rebase: the HEAD commit is a merge commit or is present on the main branch, so there is no appropriate base commit to start the rebase from\\. You can start an interactive rebase from a specific commit by selecting the commit and pressing `(.+?)\\}`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/gui/controllers/local_commits_controller.go","lineNumber":1079,"sourceCode":"\t\t\t\tif len(todos) > 0 {\n\t\t\t\t\treturn self.updateTodos(todo.Edit, todos)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}})\n\t})\n}\n\nfunc (self *LocalCommitsController) findCommitForQuickStartInteractiveRebase() (*models.Commit, error) {\n\tcommit, index, ok := lo.FindIndexOf(self.c.Model().Commits, func(c *models.Commit) bool {\n\t\treturn c.IsMerge() || c.Status == models.StatusMerged\n\t})\n\n\tif !ok || index == 0 {\n\t\terrorMsg := utils.ResolvePlaceholderString(self.c.Tr.CannotQuickStartInteractiveRebase, map[string]string{\n\t\t\t\"editKey\": self.c.UserConfig().Keybinding.Universal.Edit.String(),\n\t\t})\n\n\t\treturn nil, errors.New(errorMsg)\n\t}\n\n\treturn commit, nil\n}\n\nfunc (self *LocalCommitsController) pick(selectedCommits []*models.Commit) error {\n\tif self.isRebasing() {\n\t\treturn self.updateTodos(todo.Pick, selectedCommits)\n\t}\n\n\tpanic(\"should be disabled when not rebasing\")\n}\n\nfunc (self *LocalCommitsController) interactiveRebase(commits []*models.Commit, action todo.TodoCommand, startIdx int, endIdx int) error {\n\treturn self.interactiveRebaseWithFlag(commits, action, startIdx, endIdx, \"\")\n}\n\nfunc (self *LocalCommitsController) interactiveRebaseWithFlag(commits []*models.Commit, action todo.TodoCommand, startIdx int, endIdx int, flag string) error {","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/local_commits_controller.go#L1061-L1097","documentation":"Returned by findCommitForQuickStartInteractiveRebase when scanning Model().Commits finds no commit satisfying IsMerge() || Status == StatusMerged, or the first such commit is at index 0 (it is HEAD). Quick-starting an interactive rebase needs a safe base commit below the first merge/main-branch commit; when HEAD itself is a merge or already on the main line, there is no such base, so the user is told to select a commit and press edit instead.","triggerScenarios":"Invoking the quick-start interactive rebase action (e.g. 'e'-based start-rebase flow / squash-fixup quick start) on a history where lo.FindIndexOf(commits, IsMerge || StatusMerged) returns !ok, or index == 0.","commonSituations":"Fresh branch whose every listed commit is already merged into main (all StatusMerged); HEAD is itself a merge commit; shallow history where the boundary is not visible.","solutions":["Select a specific commit in the commits panel and press the edit key to start the interactive rebase from there.","Fetch/unguard the full history if a shallow clone hides a suitable base commit.","If all commits are merged to main, create a new branch and cherry-pick the work instead of rebasing the merged line."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"_, index, ok := lo.FindIndexOf(self.c.Model().Commits, func(c *models.Commit) bool {\n    return c.IsMerge() || c.Status == models.StatusMerged\n})\nif !ok || index == 0 {\n    // disable quick-start; require explicit commit selection\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable the quick-start rebase action via DisabledReason when no valid base commit exists.","Teach users to start interactive rebases by selecting a commit and pressing edit.","Detect shallow clones and warn that the merge base may be hidden."],"tags":["rebase","history","merge-commit","guard"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}