9

I had some files in my git named like this: "myCamelFile.rb" I just right clicked on my IDE and renamed them to all lower case so like "mycamelfile.rb" But when I do a git status I don't get any message that these are changed.

What should be done now?

5 Answers5

15

Step one: Rename them to some temp names such as "mycamelfile_temp.rb" Step two: Rename them back to "mycamelfile.rb" now all in lower case.

Bobak_KS
  • 530
  • 3
  • 10
10

You can use this to rename a file in git. You will then need to stage and commit that change.

git mv application/view/old_file_name.php application/view/new_file_name.php

Here are the complete docs on the mv command: https://www.kernel.org/pub/software/scm/git/docs/git-mv.html

usumoio
  • 3,432
  • 6
  • 29
  • 56
  • ok but now if I browse to my folder on file system, I am seeing the all lower case file names...I just renamed them the normal way we rename any file....so still I can refer to their old name too? In order to use this command. –  Jul 12 '13 at 19:52
  • 3
    Unfortunately running `git mv` only once in a case insensitive environment will not cut it. You will need to do it in two steps. Take a look at http://stackoverflow.com/questions/3011625/git-mv-and-only-change-case-of-directory – Anthony Accioly Jul 12 '13 at 20:02
6

You can just change this git config as follows:

git config core.ignorecase false

William Baker Morrison
  • 1,462
  • 4
  • 19
  • 32
Someone
  • 61
  • 1
  • 1
3

An additional tip which is not mentioned in the accepted answer:

Step one: Rename them to some temp names such as "mycamelfile_temp.rb" Step two: Rename them back to "mycamelfile.rb" now all in lower case.

After the first renaming (Step one), we should COMMIT, and then rename again (step two).

Mohammed Noureldin
  • 12,127
  • 14
  • 68
  • 86
0

to rename a file or folder needs below step:

first step is change git config on project & global:

git config core.ignorecase false
git config --global core.ignorecase false

then rename file or folder:

git mv -f myCamelFile.rb mycamelFile.rb
Mahdi Afzal
  • 537
  • 9
  • 9