I am working on Mac. Something has happened that changed the capitalisation of my files (and I started modifying them before noticing), but git doesn't see any difference. Looking at similar problems (I change the capitalization of a directory and Git doesn't seem to pick up on it, Changing capitalization of filenames in Git, How do I commit case-sensitive only filename changes in Git?, https://ocroquette.wordpress.com/2014/07/08/git-capitalization-of-file-names-and-name-conflicts/ ) I tried to set git config core.ignorecase false
but git still doesn't see the difference in the names .
At the end I solved by removing everything and doing checkout again, I wonder if there was a cleaner solution.
Here is a simplification of my session:
#Create repository
$ mkdir test && cd test && git init && git config core.ignorecase false
Initialized empty Git repository in /Users/myName/Work/test/.git/
$ git --version
git version 1.8.5.2 (Apple Git-48)
$ git config core.ignorecase
false
$ touch UPPERCASE.txt lowercase.txt CamelCase.txt
$ git add * && git commit -a -m "Original repository"
[master (root-commit) 3eeae11] Original repository
3 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 CamelCase.txt
create mode 100644 UPPERCASE.txt
create mode 100644 lowercase.txt
#some other process has messed up my filenames
$ for f in *.txt;do newname=$(echo $f|tr 'A-Z' 'a-z');mv $f $newname;done && ls .
camelcase.txt lowercase.txt uppercase.txt
$ git diff
#why there isn't any diff according to git?
#Now commit the files with the wrong capitalization
$ for f in *.txt;do echo "I am modifiying the file too" >> $f; done
$ git commit -am "file modified in content and filename"
[master 6f868b8] file modified in content and filename
3 files changed, 3 insertions(+)
$ git diff
#again any diff according to git
$ git config --get core.ignorecase
false
$ git reset --hard HEAD && ls
HEAD is now at 6f868b8 file modified in content and filename
camelcase.txt lowercase.txt uppercase.txt
$ git checkout master && ls
Already on 'master'
camelcase.txt lowercase.txt uppercase.txt
#out of desperation, but luckily it worked!
$ rm *.txt && git reset --hard HEAD && ls
HEAD is now at 6f868b8 file modified in content and filename
CamelCase.txt UPPERCASE.txt lowercase.txt