Search code examples
gitatlassian-sourcetree

Upper/Lower case discrepancy in Git and SourceTree


I've been maintaining a repo via source tree and I've come across an issue where a single file seems to have two references to it – one in lowercase and one in uppercase.
This came about after I changed the case of the title a while back. If I try deleting one, both are removed, and if I try committing them both, one always remains in the working copy.

I have tried mv on the file to see if I could force it to use just uppercase, but I still have the issue of the duplicate reference.

If anyone has a solution (and an explanation of what is happening), I'd love to hear it.


Solution

  • There is a similar issue with renamed file when using SourceTree.

    The usual workaround is to fall back to command line and:

    for instance if you want to rename "kh.png" to "KH.png", go to your git repo from command line and do:

    mv kh.png temp.png 
    # (or "mv KH.png temp.png" if kh.png as already been renamed to KH.png under Source Tree)
    git add -A
    git commit -m "renaming kh.png to KH.png"
    mv temp.png KH.png
    git add -A
    git commit --amend -m "Renamed file.txt to File.txt"