1

I am working with git on my local machine and pushing to a remote apache server. I had a file which I originally added and it was named controllers. I wanted to change this to Controllers with the uppercase file name. When I did this and pushed, my remote server keep showing the file as controllers with the lower case name. I removed the files from both local/remote and pushed again but the file keeps showing with the lower case name.

I tried git config core.ignorecase false but it did not work. My apache server allows for uppercase filenames so that's not the issue. Can't figure out what this is. Is there git cache I can clear to solve this. Driving me bananas.

bos570
  • 1,505
  • 2
  • 23
  • 45
  • Just to double check... which branch do you have checked on apache? Are you sure you're looking at the same branch? – JDB Oct 19 '17 at 19:29
  • 1
    @JDB yes, I only have one branch for the project and it is the master branch. – bos570 Oct 19 '17 at 19:30
  • Have you compared the commit SHAs to make sure that your commit has actually made it to the server? – JDB Oct 19 '17 at 19:32
  • @JDB yup, same commit. What's strange is when I remove the file from the server it will create both `controllers` and `Controllers` when only `Controllers` exists on my local machine. – bos570 Oct 19 '17 at 19:35
  • Ah... it's possible that your local git repo was confused by your operating system and didn't properly record the deletion of `controllers`. Are the files in the root directory? If so, run `git cat-file -p master^{tree}` and see if you've got two files recorded. – JDB Oct 19 '17 at 19:40
  • If it's not in the root, then run that command recursively using the SHA of each folder (aka tree) until you get to the right one. – JDB Oct 19 '17 at 19:41
  • 1
    @JDB I think you lead me down the right track. I did `git rm -r --cached controllers ` and it seems to work fine now. – bos570 Oct 19 '17 at 19:46
  • 2
    Don't change `core.ignorecase`. This is not an option for you to make changes to, this is a cache of what Git has detected your filesystem supports. By changing it, you have made Git think that you are on a different type of filesystem, and you have disabled any safe operations that come along with that. – Edward Thomson Oct 19 '17 at 19:48
  • @EdwardThomson ummm...if I did change it, is there a way to revert the change? – bos570 Oct 19 '17 at 19:49
  • Great to hear @bos570. If you want, I recommend answering your own question for the benefit of future readers (who knows... that might be you someday) – JDB Oct 19 '17 at 19:50
  • @JDB will do. Thanks for the help. – bos570 Oct 19 '17 at 19:52
  • @bos570 Yes, for sure - just `git config core.ignorecase true` - no worries! :) – Edward Thomson Oct 19 '17 at 21:42
  • Possible duplicate of [git mv and only change case of directory](https://stackoverflow.com/questions/3011625/git-mv-and-only-change-case-of-directory) – phd Oct 19 '17 at 22:13

1 Answers1

3

It seems that when I changed the file name git did not properly record the change. I remove the dir from the repo with

git rm -r --cached controllers

then added and committed back to repo and that seemed to fix it.

bos570
  • 1,505
  • 2
  • 23
  • 45