Paritosh Piplewar
Paritosh Piplewar

Reputation: 8122

After renaming the file, the git push isn't updating the filename on server

I renamed my file

 appliances.html.erb  =>  Appliances.html.erb

and, i sent push to server. The file name doesn't changed on server but content does.

I checked .gitignore and .gitignore-global. This file wasn't there.

It seems like, the file is updating on server but the filename isn't.

Hows that possible ? and how to fix it ?

EDIT: After doing

git mv  app/views/landing_pages/appliances.html.erb  app/views/landing_pages/Appliances.html.erb`

fatal: destination exists, source=app/views/landing_pages/appliances.html.erb, destination=app/views/landing_pages/Appliances.html.erb

`

Upvotes: 0

Views: 1468

Answers (3)

Paritosh Piplewar
Paritosh Piplewar

Reputation: 8122

Hows that possible ?

Read https://stackoverflow.com/a/25274416/1377943

how to fix it ?

Just use force flag. So, in this case

git mv  app/views/landing_pages/appliances.html.erb  app/views/landing_pages/Appliances.html.erb -f

Upvotes: 0

William McBrine
William McBrine

Reputation: 2256

OS X is the issue -- or rather, its filesystem, HFS+. It's case-preserving, but not (in classic Unix style) case-sensitive. So the two variations on filenames are considered the same, at some point in the process of git trying to rename them.

This obviously isn't a completely fatal issue, since it's possible in OS X to perform an operation like "mv filename Filename". But "mv filename filename" fails. Where it gets interesting is that -- with and only with a case-preserving filesystem -- you can have a file named "Filename", and something like "mv filename fileName" will still rename it.

I ran into this issue myself, and I'm sorry to say that I never did really figure out how to fix it on my Mac. I ended up doing the commit on the repo I'd cloned from, which was on a Linux box with an ext3 filesystem. Then I deleted the problem file on my Mac, pulled the changes, and recreated it with the new case that way, IIRC.

Upvotes: 3

squadette
squadette

Reputation: 8286

Did you git rm appliances.html.erb and git add Appliances.html.erb?

Upvotes: 0

Related Questions