I am trying to rename files from foobar.php to FooBar.php which is quite a challenge in Git. So far I have found out that I had to set up the git config value of ignorecas
The problem you likely have is that the default file system on a mac is case-insensitive but case preserving; it is not possible in that circumstance for file.php
and File.php
to exist at the same time - they are considered the same file.
This is easy to demonstrate:
$ cd /tmp
$ mkdir example
$ cd example/
$ git init
Initialized empty Git repository in /private/tmp/so/.git/
$ touch readme
$ git add readme
$ git commit -m "adding readme"
[master (root-commit) 05fdf7d] adding readme
0 files changed
create mode 100644 readme
$ mv readme x
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add/rm ..." to update what will be committed)
# (use "git checkout -- ..." to discard changes in working directory)
#
# deleted: readme
#
# Untracked files:
# (use "git add ..." to include in what will be committed)
#
# x
no changes added to commit (use "git add" and/or "git commit -a")
$ mv x README
$ git status
# On branch master
nothing to commit (working directory clean)
$ ls -l
total 0
-rw-r--r-- 1 andy wheel 0 Aug 1 19:38 README
In the above the file is now named README
yet according to git the file readme
exists and is unmodified.
So instead of renaming the file (which on a case-insensitive system is problematic) do it as two steps:
$ mv file.php /tmp
$ git rm file.php
$ git commit -m "deleting file"
$ git push
Make sure that the undesired file is gone from the repository. Then, move the file back to the right location and add it.
$ mv /tmp/file.php File.php
$ git add File.php
$ git commit -m "adding File"
$ git push