Rebasing fails in a repository with pre-migration lazygit config checked-in
Describe the bug
Lately with agents making the majority of the commits in some of my repos, I've been rewriting history quite frequently, and lazygit is my tool of choice for this. During such a rewrite recently I recently ran into an interesting side effect of lazygit automatically migrating its config after a version upgrade. Here's the scenario:
- I have my lazygit config checked-in into my dotfiles repo
- Lazygit is upgraded and migrates relevant parts of its config automatically
- I commit the latest config
- I try moving/squashing an earlier commit in the dotfiles repo
- During the rebase the config intermittently gets reverted to the pre-migration state
- Lazygit tries to migrate it again mid-rebase
- This stops the rebase from continuing as the working tree becomes dirty:
error: Your local changes to the following files would be overwritten by merge: config.yml
To Reproduce
The rough steps shared in the description. I've also created a minimal reproducer here, so you can use these steps:
Start lazygit with the reproducer repo's config:
TEMPDIR=$(mktemp -d) # Clone the repo to a temdir git clone https://github.com/aksh1618/lazygit-config-migration-breaks-rebase-repro.git $TEMPDIR cd $TEMPDIR # Run lazygit with the repo's checked-in config instead of default config lazygit -ucf "$TEMPDIR/config.yml" -ucd "$TEMPDIR" --debug echo "logs in $TEMPDIR/development.log"Try squashing the commit
unrelated work(<Enter>4jjs<Enter>).
Expected behavior
Lazygit doesn't try to migrate the config in the middle of an action like a rebase.
Screenshots
Sample error:
Rebasing (1/6)Rebasing (2/6)Rebasing (3/6)Rebasing (4/6)The user config file
/tmp/tmp.3L8E00TF5I/config.yml must be migrated. Attempting to do this
automatically.
The following changes were made:
- Renamed git.pagers to git.diffRenderers
- Renamed 'pager' to 'command' in git pager
Config file saved successfully to /tmp/tmp.3L8E00TF5I/config.yml
[detached HEAD ad483a8] add lazygit config (pre-0.64 pagers schema)
Author: lazygit repro <[email protected]>
Date: Sun Sep 6 18:56:48 2026 +0530
2 files changed, 4 insertions(+)
create mode 100644 config.yml
Rebasing (5/6)error: Your local changes to the following files would be
overwritten by merge:
config.yml
Please commit your changes or stash them before you merge.
Aborting
hint: Could not execute the todo command
hint:
hint: pick 052628e33986a07a90d3919366a9616b1e4db03d commit the config
lazygit auto-migrated on upgrade
hint:
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint:
hint: git rebase --edit-todo
hint: git rebase --continue
Version info:
lazygit --version
commit=v0.64.1, build date=2026-08-12T20:54:55Z, build source=binaryRelease, version=0.64.1, os=linux, arch=amd64, git version=2.55.0
Terminal info:
Kitty 0.48.2
Additional context
Note that if I don't commit the migrated config, autosquashing leads to a very similar scenario. From the logs it looks like a child lazygit process is invoked during the rebase, which is what causes the config to be migrated again mid-rebase.
Full logs from a run of the reproducer:{"command":"git --version","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git --version (1.510753ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree (wall 4.213683ms, cpu 3.965ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --show-toplevel --absolute-git-dir --git-common-dir --show-superproject-working-tree (wall 3.406849ms, cpu 3.251ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 1","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"starting main loop","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 2","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"Binary is not built with the buildBinary flag so we won't check for an update","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshing all scopes (async)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git for-each-ref \"--format=%(objectname) %(refname)\" refs/heads","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git for-each-ref \"--format=%(objectname) %(refname)\" refs/heads (wall 2.486333ms, cpu 2.294ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"RefsSnapshot took 2.586521ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 3","time":"2026-09-06T19:46:44+05:30"}
{"command":"git stash list -z --pretty=%H|%ct|%gs","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git tag --list -n --sort=-creatordate","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git branch --show-current","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git config --local --get-regexp ^remote\\.[^.]+\\.(url|pushurl)$","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 4","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed merge conflicts in 1.215489ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git stash list -z --pretty=%H|%ct|%gs (wall 2.478178ms, cpu 1.965ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 5","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 6","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed stash in 2.676801ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (wall 2.765247ms, cpu 2.471ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git config --local --get-regexp ^branch\\.","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git tag --list -n --sort=-creatordate (wall 3.108781ms, cpu 2.207ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 7","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 8","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed tags in 3.365402ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git branch --show-current (wall 3.04947ms, cpu 1.466ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git config --local --get-regexp ^remote\\.[^.]+\\.(url|pushurl)$ (wall 2.014699ms, cpu 1.639ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --symbolic-full-name main@{u}","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --symbolic-full-name master@{u}","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git for-each-ref --sort=-committerdate --format=%(refname) refs/remotes (2.978136ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git -c log.showSignature=false log -g --format=+%H%x00%ct%x00%gs%x00%P (4.070545ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 10","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 11","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed reflog in 4.490271ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 9","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 12","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"User-event queue reached a new high-water mark: 13","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed remotes in 4.441751ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git config --local --get-regexp ^branch\\. (wall 2.085131ms, cpu 1.76ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"debug","msg":"Error getting git config value for key: status.showUntrackedFiles. Error: the key is not found for [git config --get --null status.showUntrackedFiles]","time":"2026-09-06T19:46:44+05:30"}
{"command":"git worktree list --porcelain","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git status --untracked-files=all --porcelain -z --find-renames=50%","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-parse --symbolic-full-name main@{u} (wall 2.21275ms, cpu 1.831ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --symbolic-full-name master@{u}","level":"error","msg":"fatal: no such branch: 'master'\n","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-parse --symbolic-full-name master@{u} (wall 1.792613ms, cpu 1.53ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --verify --quiet refs/remotes/origin/master","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git log HEAD --topo-order --oneline --pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s --abbrev=40 -300 --no-show-signature -- (3.334744ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git worktree list --porcelain (wall 1.801068ms, cpu 1.583ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --absolute-git-dir","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for stash took 7.494µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for tags took 4.158µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for reflogCommits took 81.774µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for remotes took 40.596µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for remoteBranches took 2.514µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git status --untracked-files=all --porcelain -z --find-renames=50% (2.466315ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --verify --quiet refs/remotes/origin/master","level":"error","msg":"","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-parse --verify --quiet refs/remotes/origin/master (wall 1.808983ms, cpu 1.458ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed files in 7.814156ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed staging in 7.887294ms","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --verify --quiet refs/heads/master","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git -C /tmp/tmp.tljtdqyXAq rev-parse --path-format=absolute --absolute-git-dir (wall 1.39691ms, cpu 1.232ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed branches in 8.798843ms","time":"2026-09-06T19:46:44+05:30"}
{"command":"/usr/bin/gh auth token --hostname github.com","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for submodules took 9.257µs","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-parse --verify --quiet refs/heads/master","level":"error","msg":"","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-parse --verify --quiet refs/heads/master (wall 1.447585ms, cpu 1.139ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"command":"git rev-list HEAD ^refs/remotes/origin/main","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for files took 668.744µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"debug","msg":"using cache for key rebase.updateRefs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for localBranches took 86.172µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for worktrees took 23.444µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-list HEAD ^refs/remotes/origin/main (2.371558ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main (2.435819ms)","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed commits and commit files in 12.160899ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"Refresh took 14.871503ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"debug","msg":"using cache for key rebase.updateRefs","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for commits took 161.473µs","time":"2026-09-06T19:46:44+05:30"}
{"level":"debug","msg":"using cache for key rebase.updateRefs","time":"2026-09-06T19:46:44+05:30"}
{"level":"error","msg":"read /dev/ptmx: input/output error","time":"2026-09-06T19:46:44+05:30"}
{"level":"error","msg":"Unexpected error when running cmd task: exit status 128; Failed command: /usr/bin/git -C /tmp/tmp.tljtdqyXAq diff --no-ext-diff --unified=3 --find-renames=50% --submodule --color=always -- .","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"/usr/bin/gh auth token --hostname github.com (35.230067ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git config --local --get-regexp remote\\..*\\.gh-resolved","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"git config --local --get-regexp remote\\..*\\.gh-resolved (1.976868ms)","time":"2026-09-06T19:46:44+05:30"}
{"command":"git config --local --get-regexp remote\\..*\\.gh-resolved","level":"error","msg":"","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"Fetched 0 PRs in 608.410495ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"refreshed pull requests in 646.200393ms","time":"2026-09-06T19:46:44+05:30"}
{"level":"info","msg":"postRefreshUpdate for localBranches took 500.669µs","time":"2026-09-06T19:46:44+05:30"}
{"command":"git fetch --all --no-write-fetch-head","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:45+05:30"}
{"level":"error","msg":"read /dev/ptmx: input/output error","time":"2026-09-06T19:46:45+05:30"}
{"level":"error","msg":"Unexpected error when running cmd task: exit status 128; Failed command: /usr/bin/git -C /tmp/tmp.tljtdqyXAq diff --no-ext-diff --unified=3 --find-renames=50% --submodule --color=always -- .","time":"2026-09-06T19:46:45+05:30"}
{"level":"error","msg":"read /dev/ptmx: input/output error","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git fetch --all --no-write-fetch-head (752.382186ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"refreshing the following scopes (sync): branches,commits,remotes,tags,pullRequests,worktrees","time":"2026-09-06T19:46:46+05:30"}
{"command":"git for-each-ref \"--format=%(objectname) %(refname)\" refs/heads","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git for-each-ref \"--format=%(objectname) %(refname)\" refs/heads (wall 3.850302ms, cpu 3.393ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"RefsSnapshot took 4.080974ms","time":"2026-09-06T19:46:46+05:30"}
{"command":"git tag --list -n --sort=-creatordate","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"command":"git branch --show-current","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"command":"git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"command":"git config --local --get-regexp ^remote\\.[^.]+\\.(url|pushurl)$","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git branch --show-current (wall 2.223631ms, cpu 1.975ms)","time":"2026-09-06T19:46:46+05:30"}
{"command":"git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"command":"git rev-list HEAD ^refs/remotes/origin/main","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git -c log.showSignature=false log -g --format=+%H%x00%ct%x00%gs%x00%P (2.908455ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"refreshed reflog in 3.023791ms","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"postRefreshUpdate for reflogCommits took 66.795µs","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git config --local --get-regexp ^remote\\.[^.]+\\.(url|pushurl)$ (wall 2.456487ms, cpu 1.713ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git tag --list -n --sort=-creatordate (wall 4.481215ms, cpu 4.065ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"refreshed tags in 4.607732ms","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git rev-list HEAD ^refs/remotes/origin/main (2.334128ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git rev-list refs/heads/main ^main@{u} ^refs/remotes/origin/main (2.412895ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git for-each-ref --sort=-committerdate --format=%(HEAD)%00%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(push:track)%00%(subject)%00%(objectname)%00%(committerdate:unix) refs/heads (wall 4.882507ms, cpu 4.438ms)","time":"2026-09-06T19:46:46+05:30"}
{"command":"git config --local --get-regexp ^branch\\.","level":"debug","msg":"RunCommand","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"postRefreshUpdate for tags took 12.603µs","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git log HEAD --topo-order --oneline --pretty=format:+%H%x00%at%x00%aN%x00%ae%x00%P%x00%m%x00%D%x00%s --abbrev=40 -300 --no-show-signature -- (4.311266ms)","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"refreshed commits and commit files in 6.928355ms","time":"2026-09-06T19:46:46+05:30"}
{"level":"info","msg":"git config --local --get-regexp ^branch\\. (wall 1.661767ms, cpu 1.32ms)","time":"2026-09-06T19:46:46+05:30"}
{"command":"git worktree list --porcelain","level":"de
Source: jesseduffield/lazygit