Re: Git Bug Report - Weird file behavior and unable to change branches with no changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried closing all programs, restarting the computer, running command
prompt as admin, running garbage collector, and it still fails to
allow me to run "git checkout -- ." It always says Unlock of file
failed. I think my git instance has been entirely broken. I have no
idea why. Definitely feels like a bug. Thanks in advance. I've been on
this for many hours and can't use git or change branches or anything.
Been using git fine for close to a decade.

On Thu, Apr 24, 2025 at 10:50 PM Justin Golden <justingolden21@xxxxxxxxx> wrote:
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> I have two component files, Button and Tabs
>
> There was a casing issue (button vs Button) before that I thought I
> resolved, but it failed when I built in dev
>
> So because git doesn't track casing changes, I did the correct thing
> and deleted Button, committed my change that I deleted, then added it
> back, and committed that.
>
> I ran git config core.ignorecase and it said it was true, so I set it
> to false and then checked and it said it's false.
>
> Now for some reason, it shows that I'm CREATING TABS as a new file in
> my working changes. AND, when I check the pull request, tabs is there
> but button is missing
>
> So I clear the git cache with git rm --cached -r . and then run git
> add . to add every file.
>
> And it shows 3 file changes: 1) deleting Tabs, 2) changing another
> unrelated file which has no changes shown, 3) Also changing another
> unrelated file which has no changes shown
>
> So I push it and locally I have tabs and button and in the pull
> request I have tabs and button locally. So now I have no working
> changes, everything is good, and I try changing branches from design
> to dev.
>
> It won't let me because I have changes. I check and it says I have no changes.
>
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch design-system
> Your branch is up to date with 'origin/design-system'.
>
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
>         Please move or remove them before you switch branches.
>         Aborting
>
>
> What did you expect to happen? (Expected behavior)
>
> The file changes to be tracked. No working changes.
>
> What happened instead? (Actual behavior)
>
> What I mentioned above. Random files were changed, no changes shown.
> At minimum, after status says tree clean, it shouldn't stop me from
> changing branches because I have working files.
>
> What's different between what you expected and what actually happened?
>
> As I explained above, the entire thing is unintuitive and seems buggy
> to me. I love (and trust) git, but this definitely seems like a bug. I
> know that no changes shown can still have line endings and that git
> doesn't track casing unless you tell it to. Still, all of the other
> behaviors I experienced seem like bugs. I wish I had repro steps or
> anything else for you.
>
> Anything else you want to add:
>
> Thank you for working on git!
>
> [System Info]
> git version:
> git version 2.36.1.windows.1
> cpu: x86_64
> built from commit: e2ff68a2d1426758c78d023f863bfa1e03cbc768
> sizeof-long: 4
> sizeof-size_t: 8
> shell-path: /bin/sh
> feature: fsmonitor--daemon
> uname: Windows 10.0 19045
> compiler info: gnuc: 11.3
> libc info: no libc information available
> $SHELL (typically, interactive shell): <unset>
>
> ---
>
> git clean -fdx
>
> This deleted almost every file in node_modules. It's gitignored.
> Here's the gitignore:
>
>
> # Mac
> .DS_Store
>
> # Packages
> node_modules
>
> # Build
> /build
> /.svelte-kit
> /package
> /.netlify
> coverage
> vite.config.js.timestamp-*.mjs
>
>
> I know this is because of the -x flag now. But even after that, when I
> ran git status, it was clean, then git checkout dev failed:
>
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch design-system
> Your branch is up to date with 'origin/design-system'.
>
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git branch dev
> fatal: a branch named 'dev' already exists
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> ---
>
> Currently unable to switch branches:
>
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch design-system
> Your branch is up to date with 'origin/design-system'.
>
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git branch dev
> fatal: a branch named 'dev' already exists
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout -b temp
> Switched to a new branch 'temp'
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch temp
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git add .
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch temp
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
>
> Also:
>
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> C:\Users\User\Documents\GitHub\desktopclock>del .git\index
>
> C:\Users\User\Documents\GitHub\desktopclock>git reset --hard HEAD
> HEAD is now at 98c4b5c4 Fix file casing issue and re add components
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch temp
> nothing to commit, working tree clean
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> error: The following untracked working tree files would be overwritten
> by checkout:
>         src/lib/components/UI/Tabs.svelte
> Please move or remove them before you switch branches.
> Aborting
>
> C:\Users\User\Documents\GitHub\desktopclock>
>
> ---
>
> Fixed by manually deleting the file via windows explorer:
>
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch temp
> Changes not staged for commit:
>   (use "git add/rm <file>..." to update what will be committed)
>   (use "git restore <file>..." to discard changes in working directory)
>         deleted:    src/lib/components/ui/Tabs.svelte
>
> no changes added to commit (use "git add" and/or "git commit -a")
>
> C:\Users\User\Documents\GitHub\desktopclock>git checkout dev
> Switched to branch 'dev'
> Your branch is up to date with 'origin/dev'.
>
> C:\Users\User\Documents\GitHub\desktopclock>git status
> On branch dev
> Your branch is up to date with 'origin/dev'.
>
> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
>         src/lib/components/ui/Tabs.svelte
>
> nothing added to commit but untracked files present (use "git add" to track)
>
> C:\Users\User\Documents\GitHub\desktopclock>
>
>
> It showed I deleted the file from temp branch, then when changing to
> dev that I am adding the file.
>
> Git certainly seems like it's in a broken state and I'm completely
> unable to fix it.
>
> Thank you in advance!



-- 
Justin Golden
contact@xxxxxxxxxxxxxxx
https://justingolden.me





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux