Not quite sure how to explain this clearly, but here goes.
Due to a bug in Tortoise-git, we’ve ended with a situation like this;
All our code should be under a directory structure like this (this is Symfony2 project);
src/XYZ/OurExitingBundle src/XYZ/AnotherExcitingBundle
but, due (we think) to the bug in Tortoise-git, when we pull the code onto a linux box, we’ve got;
src/XYZ/OurExcitingBundle src/XYZ/AnotherExcitingBundle src/xyz/ourexcitingbundle src/xyz/anotherexcitingbundle
(i.e. the actual directories, plus a lowercase equivalent). The files making our project seem to be split randomly between the CamelCase and the lowercase directories.
As we are developing on Windows machines, this does not matter whilst coding, but when the code is pushed to our linux server, everything falls over, as files are not where they are supposed to be, or a file exists in the CamelCase directory, but a newer version is in the lowercase directory.
So, my question is, is there a way to “merge” all the files in the lowercase directories into their equivalents in the CamelCase directories, ending up with all the latest code in just the CamelCase directories?
Many thanks in advance for all help.
Advertisement
Answer
There are two things to do here. The easiest of which it to make sure each client on windows has
core.ignorecase = true
set on each of their repositories. This means that git will ignore any differences in case locally and should use the same case as used in the local repository.
Secondly all the paths that are have incorrect spacing will need to be changed in the repository. This has the side effect that the team would have to pull this new version of the history. The filter-branch
command is often used for this type of task. This would be something like:
git filter-branch --tree-filter 'test -d src/xyz && for f in `git ls-files src/xyz`; do git mv "$f" src/XYZ; done'
There have also been changes to Tortoise Git to improve support for handling case sensitivity:
So it’s also worth checking the version you are using.