support Weirdness with a renamed file
Hi everyone,
I work with a .NET codebase, developed in Visual Studio, with the repo stored in GitHub and commits/pushes etc. are done within VS. At some point in the past a developer has renamed a little-used file from jip.vb to JIP.vb, which is now causing some strange and frustrating issues after some recent changes were made to the file.
Following a recent commit and push of changes to the file, the Git Changes window in VS shows that there are uncommitted changes to jip.vb. Double clicking to view the diff shows no changes present. I can't commit the change, as there aren't any, nor can I successfully "Undo Changes" in VS front-end.
I do have git bash available to me, but my very rudimentary knowledge of git is preventing me from both understanding and fixing this issue.
So, hivemind, can you help me please?
2
u/Mrpoopybutthole69692 Oct 26 '26
I would run git rm --cached jib.vb in the terminal and then run git add JIP.vb and commit it, push it to your repo
20
u/ritchie70 Oct 26 '26
Windows isn’t case sensitive. Git is.
10
u/CartographerDue5382 Oct 26 '26
windows doesn't treat jip.vb and JIP.vb as different files, so the index is stuck on the old casing and vs shows a diff with nothing in it. two-step rename forces git to record the case: git mv jip.vb jip-tmp.vb then git mv jip-tmp.vb JIP.vb and commit that. don't turn core.ignorecase off to hide it, that makes every other file noisy.
3
u/soundman32 Oct 26 '26
1Rename the file to something else, commit, push, rename the file to the exact casing you require, commit, push. Use
git mvto rename.1
u/WoodyTheWorker Oct 26 '26
Convert your directory where you store your local clones to case-sensitive.
Windows support case sensitivity, but you have to explicitly enable it for a directory.
1
u/Medical-Captain1550 Oct 27 '26
check git ls-files -s | grep -i jip.vb first, because if both jip.vb and JIP.vb exist in the index tree on github, windows ntfs will keep colliding them until you run git rm --cached on the lowercase entry and commit
1
u/ResidentPomegranate6 Oct 26 '26
classic case-only rename on a case-insensitive filesystem, so the index still holds jip.vb. run `git ls-files | grep -i jip` and check core.ignorecase.
0
u/JaguarMammoth6231 Oct 26 '26
Try deleting the file and then restoring it using
git restore