git status showing two files modified after rename due to case

case-insensitive, case-sensitive, git

Solution

Use 'git revert' on that commit where you included the renamed version of the file. Then you can [properly] rename the file - as you indicated in your description - and create a new commit.

Example of properly renaming the file:

git mv --force Foo.js foo.js

Problem

Using git, I apparently didn't use the proper approach when renaming files based on case sensitive file names on my Mac. Here is a simulation of the situation I'm in currently and am unsure how to get out of... Create the repo and add a sample file: ``` git init touch Foo.js git add . git commit -m 'adding Foo.js' ``` How I 'renamed' file (but should have used `git mv...` instead :( ) ``` mv Foo.js foo.js git status ``` Git status didn't show any changes so I updated the `core.ignorecase` property ``` git config core.ignorecase false git status ``` Now it shows that I need to add foo.js. ``` git add foo.js git status git commit -m 'renaming Foo.js to foo.js' ``` Now if I try to edit `foo.js` ``` vim foo.js <-- edit foo.js git status Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: Foo.js modified: foo.js ``` If I try to `git rm Foo.js` it also is trying to delete my `foo.js` file as well. My current `git --version` is `2.1.2` Any thoughts on how I fix things so `Foo.js` is gone and I only have `foo.js`?

Original source