{"thread":{"id":"63347","subject":"Git Bug Report - Weird file behavior and unable to change branches with no changes","startedAt":"2025-04-25T05:50:59Z","lastAt":"2025-04-25T07:35:30Z","messageCount":2,"participants":["Justin Golden"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"516731","messageId":"CALDohY2O1fbSDR8kTdpQCnZp5Cbc6QYKmT+LhbbaExgAqxaWoQ@mail.gmail.com","threadId":"63347","inReplyTo":null,"subject":"Git Bug Report - Weird file behavior and unable to change branches with no changes","fromName":"Justin Golden","fromEmail":"justingolden21@gmail.com","sentAt":"2025-04-25T05:50:47Z","receivedAt":"2025-04-25T05:50:59Z","isPatch":false,"sender":{"key":"justingolden21@gmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\nI have two component files, Button and Tabs\n\nThere was a casing issue (button vs Button) before that I thought I\nresolved, but it failed when I built in dev\n\nSo because git doesn't track casing changes, I did the correct thing\nand deleted Button, committed my change that I deleted, then added it\nback, and committed that.\n\nI ran git config core.ignorecase and it said it was true, so I set it\nto false and then checked and it said it's false.\n\nNow for some reason, it shows that I'm CREATING TABS as a new file in\nmy working changes. AND, when I check the pull request, tabs is there\nbut button is missing\n\nSo I clear the git cache with git rm --cached -r . and then run git\nadd . to add every file.\n\nAnd it shows 3 file changes: 1) deleting Tabs, 2) changing another\nunrelated file which has no changes shown, 3) Also changing another\nunrelated file which has no changes shown\n\nSo I push it and locally I have tabs and button and in the pull\nrequest I have tabs and button locally. So now I have no working\nchanges, everything is good, and I try changing branches from design\nto dev.\n\nIt won't let me because I have changes. I check and it says I have no changes.\n\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch design-system\nYour branch is up to date with 'origin/design-system'.\n\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\n        Please move or remove them before you switch branches.\n        Aborting\n\n\nWhat did you expect to happen? (Expected behavior)\n\nThe file changes to be tracked. No working changes.\n\nWhat happened instead? (Actual behavior)\n\nWhat I mentioned above. Random files were changed, no changes shown.\nAt minimum, after status says tree clean, it shouldn't stop me from\nchanging branches because I have working files.\n\nWhat's different between what you expected and what actually happened?\n\nAs I explained above, the entire thing is unintuitive and seems buggy\nto me. I love (and trust) git, but this definitely seems like a bug. I\nknow that no changes shown can still have line endings and that git\ndoesn't track casing unless you tell it to. Still, all of the other\nbehaviors I experienced seem like bugs. I wish I had repro steps or\nanything else for you.\n\nAnything else you want to add:\n\nThank you for working on git!\n\n[System Info]\ngit version:\ngit version 2.36.1.windows.1\ncpu: x86_64\nbuilt from commit: e2ff68a2d1426758c78d023f863bfa1e03cbc768\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19045\ncompiler info: gnuc: 11.3\nlibc info: no libc information available\n$SHELL (typically, interactive shell): <unset>\n\n---\n\ngit clean -fdx\n\nThis deleted almost every file in node_modules. It's gitignored.\nHere's the gitignore:\n\n\n# Mac\n.DS_Store\n\n# Packages\nnode_modules\n\n# Build\n/build\n/.svelte-kit\n/package\n/.netlify\ncoverage\nvite.config.js.timestamp-*.mjs\n\n\nI know this is because of the -x flag now. But even after that, when I\nran git status, it was clean, then git checkout dev failed:\n\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch design-system\nYour branch is up to date with 'origin/design-system'.\n\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git branch dev\nfatal: a branch named 'dev' already exists\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\n---\n\nCurrently unable to switch branches:\n\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch design-system\nYour branch is up to date with 'origin/design-system'.\n\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git branch dev\nfatal: a branch named 'dev' already exists\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout -b temp\nSwitched to a new branch 'temp'\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch temp\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git add .\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch temp\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\n\nAlso:\n\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>del .git\\index\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git reset --hard HEAD\nHEAD is now at 98c4b5c4 Fix file casing issue and re add components\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch temp\nnothing to commit, working tree clean\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nerror: The following untracked working tree files would be overwritten\nby checkout:\n        src/lib/components/UI/Tabs.svelte\nPlease move or remove them before you switch branches.\nAborting\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>\n\n---\n\nFixed by manually deleting the file via windows explorer:\n\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch temp\nChanges not staged for commit:\n  (use \"git add/rm <file>...\" to update what will be committed)\n  (use \"git restore <file>...\" to discard changes in working directory)\n        deleted:    src/lib/components/ui/Tabs.svelte\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\nSwitched to branch 'dev'\nYour branch is up to date with 'origin/dev'.\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\nOn branch dev\nYour branch is up to date with 'origin/dev'.\n\nUntracked files:\n  (use \"git add <file>...\" to include in what will be committed)\n        src/lib/components/ui/Tabs.svelte\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nC:\\Users\\User\\Documents\\GitHub\\desktopclock>\n\n\nIt showed I deleted the file from temp branch, then when changing to\ndev that I am adding the file.\n\nGit certainly seems like it's in a broken state and I'm completely\nunable to fix it.\n\nThank you in advance!\n"},{"id":"516766","messageId":"CALDohY0gaMLviB-HRvwFWr5uRjfhpidQiMaFGgqmGQhj-XWaxQ@mail.gmail.com","threadId":"63347","inReplyTo":"CALDohY2O1fbSDR8kTdpQCnZp5Cbc6QYKmT+LhbbaExgAqxaWoQ@mail.gmail.com","subject":"Re: Git Bug Report - Weird file behavior and unable to change branches with no changes","fromName":"Justin Golden","fromEmail":"justingolden21@gmail.com","sentAt":"2025-04-25T07:35:17Z","receivedAt":"2025-04-25T07:35:30Z","isPatch":false,"sender":{"key":"justingolden21@gmail.com","avatar":null},"body":"I tried closing all programs, restarting the computer, running command\nprompt as admin, running garbage collector, and it still fails to\nallow me to run \"git checkout -- .\" It always says Unlock of file\nfailed. I think my git instance has been entirely broken. I have no\nidea why. Definitely feels like a bug. Thanks in advance. I've been on\nthis for many hours and can't use git or change branches or anything.\nBeen using git fine for close to a decade.\n\nOn Thu, Apr 24, 2025 at 10:50 PM Justin Golden <justingolden21@gmail.com> wrote:\n>\n> What did you do before the bug happened? (Steps to reproduce your issue)\n>\n> I have two component files, Button and Tabs\n>\n> There was a casing issue (button vs Button) before that I thought I\n> resolved, but it failed when I built in dev\n>\n> So because git doesn't track casing changes, I did the correct thing\n> and deleted Button, committed my change that I deleted, then added it\n> back, and committed that.\n>\n> I ran git config core.ignorecase and it said it was true, so I set it\n> to false and then checked and it said it's false.\n>\n> Now for some reason, it shows that I'm CREATING TABS as a new file in\n> my working changes. AND, when I check the pull request, tabs is there\n> but button is missing\n>\n> So I clear the git cache with git rm --cached -r . and then run git\n> add . to add every file.\n>\n> And it shows 3 file changes: 1) deleting Tabs, 2) changing another\n> unrelated file which has no changes shown, 3) Also changing another\n> unrelated file which has no changes shown\n>\n> So I push it and locally I have tabs and button and in the pull\n> request I have tabs and button locally. So now I have no working\n> changes, everything is good, and I try changing branches from design\n> to dev.\n>\n> It won't let me because I have changes. I check and it says I have no changes.\n>\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch design-system\n> Your branch is up to date with 'origin/design-system'.\n>\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n>         Please move or remove them before you switch branches.\n>         Aborting\n>\n>\n> What did you expect to happen? (Expected behavior)\n>\n> The file changes to be tracked. No working changes.\n>\n> What happened instead? (Actual behavior)\n>\n> What I mentioned above. Random files were changed, no changes shown.\n> At minimum, after status says tree clean, it shouldn't stop me from\n> changing branches because I have working files.\n>\n> What's different between what you expected and what actually happened?\n>\n> As I explained above, the entire thing is unintuitive and seems buggy\n> to me. I love (and trust) git, but this definitely seems like a bug. I\n> know that no changes shown can still have line endings and that git\n> doesn't track casing unless you tell it to. Still, all of the other\n> behaviors I experienced seem like bugs. I wish I had repro steps or\n> anything else for you.\n>\n> Anything else you want to add:\n>\n> Thank you for working on git!\n>\n> [System Info]\n> git version:\n> git version 2.36.1.windows.1\n> cpu: x86_64\n> built from commit: e2ff68a2d1426758c78d023f863bfa1e03cbc768\n> sizeof-long: 4\n> sizeof-size_t: 8\n> shell-path: /bin/sh\n> feature: fsmonitor--daemon\n> uname: Windows 10.0 19045\n> compiler info: gnuc: 11.3\n> libc info: no libc information available\n> $SHELL (typically, interactive shell): <unset>\n>\n> ---\n>\n> git clean -fdx\n>\n> This deleted almost every file in node_modules. It's gitignored.\n> Here's the gitignore:\n>\n>\n> # Mac\n> .DS_Store\n>\n> # Packages\n> node_modules\n>\n> # Build\n> /build\n> /.svelte-kit\n> /package\n> /.netlify\n> coverage\n> vite.config.js.timestamp-*.mjs\n>\n>\n> I know this is because of the -x flag now. But even after that, when I\n> ran git status, it was clean, then git checkout dev failed:\n>\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch design-system\n> Your branch is up to date with 'origin/design-system'.\n>\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git branch dev\n> fatal: a branch named 'dev' already exists\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> ---\n>\n> Currently unable to switch branches:\n>\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch design-system\n> Your branch is up to date with 'origin/design-system'.\n>\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git branch dev\n> fatal: a branch named 'dev' already exists\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout -b temp\n> Switched to a new branch 'temp'\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch temp\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git add .\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch temp\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n>\n> Also:\n>\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>del .git\\index\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git reset --hard HEAD\n> HEAD is now at 98c4b5c4 Fix file casing issue and re add components\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch temp\n> nothing to commit, working tree clean\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> error: The following untracked working tree files would be overwritten\n> by checkout:\n>         src/lib/components/UI/Tabs.svelte\n> Please move or remove them before you switch branches.\n> Aborting\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>\n>\n> ---\n>\n> Fixed by manually deleting the file via windows explorer:\n>\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch temp\n> Changes not staged for commit:\n>   (use \"git add/rm <file>...\" to update what will be committed)\n>   (use \"git restore <file>...\" to discard changes in working directory)\n>         deleted:    src/lib/components/ui/Tabs.svelte\n>\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git checkout dev\n> Switched to branch 'dev'\n> Your branch is up to date with 'origin/dev'.\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>git status\n> On branch dev\n> Your branch is up to date with 'origin/dev'.\n>\n> Untracked files:\n>   (use \"git add <file>...\" to include in what will be committed)\n>         src/lib/components/ui/Tabs.svelte\n>\n> nothing added to commit but untracked files present (use \"git add\" to track)\n>\n> C:\\Users\\User\\Documents\\GitHub\\desktopclock>\n>\n>\n> It showed I deleted the file from temp branch, then when changing to\n> dev that I am adding the file.\n>\n> Git certainly seems like it's in a broken state and I'm completely\n> unable to fix it.\n>\n> Thank you in advance!\n\n\n\n-- \nJustin Golden\ncontact@justingolden.me\nhttps://justingolden.me\n"}]}