views:

43

answers:

5

alt text

Referencing the screenshot above, I changed the name of the lowest-level folder in the tree. For example, I changed "Chips" to "chips." Oddly, Git refuses to recognize the following command when I try to add it to the commit:

git add public/images/chips/

The only way I can get it to add the file to the commit is by adding an actual file in the subfolder.

Any ideas how to handle?

+2  A: 

In general when changing file or directory names, you'll want to use the following:

git mv oldfile newfile

This will tell git to actually add the changes so that you can commit them. So, try manually changing it back with

mv chips Chips

and then run

git mv Chips chips
Topher Fangio
so this is interesting...it won't let me change it from Chips to chips...but it will let me change from Chips to chip
keruilin
I noticed this a few days ago. It seems to be that git-mv ignores changes that are different in case only.
Jeremy
@keruilin - Are you on a Windows box? This doesn't appear to be true on a Linux machine.
Topher Fangio
I'm on a MAC OS.
keruilin
@keruilin - Very interesting! What filesystem format are you using? Mac OS Extended (Journaled)?
Topher Fangio
A: 

Rollback your changes and run git mv Chips chips

Lucho
A: 

How did you rename the folders? I always move / rename files in my repository using git mv (git help mv). Try mving the files/folders back to what git knew they looked like, then use git's version of move instead?

amireh
A: 

Try git add -A. This will detect renames/deletes that weren't done through git mv/git rm.

Veeti
Didn't work....
keruilin
A: 

This is probably only an issue when working with an OS that has case-insensitive filesystems, like OSX and Windows. You should do the rename on a unix system / case-sensitive filesystem - it will work there with either way (git mv or first rename, then git add - it will detect the move).

Then back on your case-insensitive system you'll probably get conflicts during the pull. It may help to manually rename there and try the pull again - git should merge these changes properly then (because there're actually none if the commit changed nothing else within that directory).

You can also get around this by some advanced git and rename trickery: Rename to chips-tmp first, commit, then rename to chips, amend your previous commit. Only then push to your upstream repositoy.

Look here:

hurikhan77