user1899082
user1899082

Reputation:

Updating file names in Git from camel case to all lower case

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?

Upvotes: 15

Views: 13846

Answers (5)

Mahdi Afzal
Mahdi Afzal

Reputation: 837

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

Upvotes: 4

Someone
Someone

Reputation: 171

You can just change this git config as follows:

git config core.ignorecase false

Upvotes: 17

Mohammed Noureldin
Mohammed Noureldin

Reputation: 16946

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).

Upvotes: 3

Bobak_KS
Bobak_KS

Reputation: 554

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.

Upvotes: 16

usumoio
usumoio

Reputation: 3568

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

Upvotes: 10

Related Questions