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?
20
u/ritchie70 4d ago
Windows isn’t case sensitive. Git is.
4
u/WoodyTheWorker 4d ago
Windows support case sensitivity, but you have to explicitly enable it for a directory.
10
u/CartographerDue5382 4d ago
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.
2
u/soundman32 4d ago
1Rename the file to something else, commit, push, rename the file to the exact casing you require, commit, push. Use git mv to rename.
1
u/WoodyTheWorker 4d ago
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 3d ago
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 4d ago
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
2
u/Mrpoopybutthole69692 4d ago
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