Skip to content

lazygit Rebase/Fixup/Reword/Squash onto wrong commit (sibling branch) when git.log.showWholeGraph=true #4997

@otakenz

Description

@otakenz

Describe the bug

When git.log.showWholeGraph is enabled or toggled using "Ctrl+L" in lazygit, rebasing or fixup/squashing/reword commits on a feature branch, a wrong rebase base is chosen that caused it to pulls in commits from sibling branches that share the same base (e.g., main or develop), even if those commits are unrelated to the current branch.

To Reproduce

Steps to reproduce the behavior:

  1. Create two feature branches from main
  2. Open lazygit with git.log.showWholeGraph : true (edit in config.yml or toggle using "Ctrl+L")
  3. Checkout feature/B.
  4. Perform a rebase or fixup on B1 (e.g., squash into previous or rebase onto main).
  5. Observe: Commit A1 from feature/A now appears in the commit history/log of feature/B.

Expected behavior

  1. Rebase/fixup on feature/B should only affect commits on feature/B.
  2. Commits from feature/A should not be included ("pollution").
  3. A rebase base should be chosen correctly.
  4. This matches behavior when using git rebase directly in the CLI.

Screenshots

If applicable, add screenshots to help explain your problem.

  1. Create two feature branches, here I call it "dev-a" and "dev-b", each has two commits branching off the main branch.
Image
  1. Now, I will checkout dev-b and perform "squash" by pressing "s". Observe that the "pollution" happened here, as the git graph now shows that commits in "dev-a" is being merged into the commit history of "dev-b"
Image
  1. Now I revert it, still checked out to "dev-b" branch and by using git CLI to perform squash the
    DESIRED OUTCOME is as shown.
git rebase -i HEAD~2
Image Image
  1. Another example, using lazygit rebase feature by pressing "i"
Image
  1. Same "pollution" happened here as well, this behavior has been replicable in fixup, reword as well, as long as the git log --all
Image

Here onwards showcases some of my debugging efforts

  1. Using lazygit --debug and lazygit --logs, when I perform rebase using lazygit by pressing "i".
    Here the base commit chosen is 333e0175a, this commit points to "dev-a" instead of "main" branch.
Image Image
  1. The function responsible for obtaining the base commits used in the interactive rebase, called by "quickStartInteractiveRebase"
Image

Version info:

  • Run lazygit --version and paste the result here
    commit=3de12b7fde56cec5d0fc27b1986180c27e50d971, build date=2025-09-17T18:42:05Z, build source=binaryRelease, version=0.55.1, os=linux, arch=amd64, git version=2.43.0

  • Run git --version and paste the result here
    git version 2.43.0

Additional context

Add any other context about the problem here.

Note

Please try updating to the latest version or manually building the latest master to see if the issue still occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions