via: Lesson Learned – I Can’t Get My Git Repo Clean! | DrupalEasy
One file kept getting added to the git modified list: service/src/main/MySOAPdefinition.pas
.
It was part of a repository that had been migrated from SVN (more on that in a future blog post) and along the way been renamed in directory service/src/main
from MySOAPdefinition.pas
to MySoapDefinition.pas
. SVN (and TortoiseSVN) don’t object to this. But git does.
You’d see this on the command-line:
>git status On branch develop Your branch is up-to-date with 'origin/develop'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: service/src/main/MySOAPdefinition.pas no changes added to commit (use "git add" and/or "git commit -a") >git add service\src\main\MySoapDefinition.pas >git status On branch develop Your branch is up-to-date with 'origin/develop'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: service/src/main/MySOAPdefinition.pas no changes added to commit (use "git add" and/or "git commit -a")
Basically the add
would do nothing.
On Windows, this is how to get around this:
>git mv service\src\main\MySOAPdefinition.pas service\src\main\MySoapDefinition.pas >git status On branch develop Your branch is up-to-date with 'origin/develop'. Changes to be committed: (use "git reset HEAD ..." to unstage) renamed: service/src/main/MySOAPdefinition.pas -> service/src/main/MySoapDefinition.pas Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)
But on unices, you need to --force
this otherwise you will get an error:
$ git mv MySOAPdefinition.pas MySoapDefinition.pas
fatal: destination exists, source=service/src/main/MySOAPdefinition.pas, destination=service/src/main/MySoapDefinition.pas
$ git mv MySOAPdefinition.pas MySoapDefinition.pas --force
Now it worked.
–jeroen
Filed under: Delphi, Delphi XE8, Development, git, OS X, OS X Maverick, Power User, Software Development, Source Code Management, SourceTree, Windows, Windows 7
