lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Weird behavior since 0.56.0: Changes from origin/main appear as staged changed files in my working copy

Open ruudk opened this issue 1 month ago • 9 comments

Describe the bug

Ok, first of all, I know this is going to be a vague report, but I've been using Lazygit for a year now, and only see this weird issue since a few days. I have the feeling it's related to the latest release, but can't put my hand on it, or reproduce it.

Sidenote, I'm using git worktree's. Since a branch can only be checked out by a single worktree, often I checkout a detached head on one of the other worktree's, to not block the main branch from being checked out.

For example, worktree 1 has main checked out and worktree 2 has this: Image

Every now and then, I suddenly see this on my main branch:

Image

Upon closely inspecting it. These are basically the opposite (revert) of changes that are visible in main.

Also good to know, is that I often have multiple Lazygit instances running, per worktree.

I'm just posting this here, in case somebody else has something weird like this too. If that's the case, it's related to Lazygit. If i'm the only one, it might be related to something else.

Version info:

commit=, build date=, build source=Homebrew, version=0.56.0, os=darwin, arch=arm64, git version=2.51.2 git version 2.51.2

ruudk avatar Nov 07 '25 09:11 ruudk

This sounds similar to what we fixed in #4833. Maybe that fix wasn't complete enough or something, or there is some other operation that I'm not aware of that has a similar problem.

stefanhaller avatar Nov 07 '25 09:11 stefanhaller

It's not related to the fact that 2 Lazygit instances are open. Because I just had the same issue, with only 1 instance open.

ruudk avatar Nov 07 '25 09:11 ruudk

It just happened again, and this is what I see in my reflog:

Image

ruudk avatar Nov 07 '25 09:11 ruudk

So did you press either p or f?

stefanhaller avatar Nov 07 '25 09:11 stefanhaller

Not that I recall.

ruudk avatar Nov 07 '25 09:11 ruudk

When I Press p I get:

Image

Same for f

ruudk avatar Nov 07 '25 09:11 ruudk

I have the feeling this is related to the automatic fetching that happens from time to time. Is there a way to turn that off? That might mitigate this problem until it's fixed.

ruudk avatar Nov 13 '25 11:11 ruudk

I have the feeling this is related to the automatic fetching that happens from time to time. Is there a way to turn that off? That might mitigate this problem until it's fixed.

You can add this to your config.yml:

git:
    autoFetch: false

Link to the docs.

mark2185 avatar Nov 13 '25 11:11 mark2185

Is there a way to turn that off?

Of course:

git:
  autoFetch: false

I'm pretty sure that's not it though, because fetching doesn't affect your working directories at all. And also, if you turn this off and then you don't see the problem again, this doesn't prove anything, because this also turns off forwarding of the main branches, which is more likely to be the problem. So you probably want to turn that off separately first (git.autoForwardBranches: none).

However, if it's related to auto-forwarding then you should see an entry "Auto-forward branches" in the command log when it happened.

stefanhaller avatar Nov 13 '25 11:11 stefanhaller