Weird behavior since 0.56.0: Changes from origin/main appear as staged changed files in my working copy
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:
Every now and then, I suddenly see this on my main branch:
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
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.
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.
It just happened again, and this is what I see in my reflog:
So did you press either p or f?
Not that I recall.
When I Press p I get:
Same for f
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.
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
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.