Have you ever seen a file that git can’t reset/checkout? I have.
Here’s an example:
12345678910111213141516
$ git status -sb
## master M TCPData.java
$ git reset --hard
HEAD is now at 1234567 Some commit
$ git status -sb
## master M TcpData.java
$ git checkout -- TcpData.java
$ git status -sb
## master M TcpData.java
It turned out the file was renamed in one of the branches TcpData.java => TCPData.java, and after the latest merge here is the mess. This is observed on OS X. By the way:
12
$ ls
TCPData.java
Here the file is with capital letters. git stores the filenames as is (case-sensitive) while the default option on the OS X’s HFS+ filesystem is case-insensitive filenames. So you have to deal with that:
1234567891011121314151617181920
$ git mv TCPData.java 1.java
$ git status -sb
## masterR TCPData.java -> 1.java
D TcpData.java
$ git rm TcpData.java
rm 'TcpData.java'$ git status -sb
## masterR TCPData.java -> 1.java
D TcpData.java
$ git mv 1.java TCPData.java
$ git status -sb
## masterD TcpData.java
Ha, it’s quite a twist. The git output suggests that git just removed the TcpData.java file from the current tree, which stops the mess.