简体   繁体   English

如何从git-svn中恢复在存储库中放置一个不同的culduped复制文件?

[英]How to recover from git-svn putting a different cased dulplicate file in the repository?

Git-svn allowed for a duplicate filename, just with different case, to be added to our subversion repository. Git-svn允许将重复的文件名(只是具有不同的大小写)添加到我们的subversion存储库中。

On Windows this meant that subversion could not checkout the file, complaining of a duplicate. 在Windows上,这意味着subversion无法检出文件,抱怨重复。

Another developer deleted the incorrectly cased version from the repository. 另一位开发人员从存储库中删除了错误的套件版本。 Now when trying to do a git-svn rebase I get a "could not detach HEAD" message and a complaint about the file name in question being untracked and needing to be overwritten. 现在,当我尝试执行git-svn rebase时,我得到一个“无法分离HEAD”的消息,并且有关该文件名未被跟踪且需要被覆盖的投诉。 Deleting the file makes git-svn complain that the file needs to be updated. 删除该文件会使git-svn抱怨该文件需要更新。

Is the only solution to copy the repository to a machine with a case sensitive filesystem do the rebase then move it back? 将存储库复制到具有区分大小写的文件系统的计算机的唯一解决方案是否执行rebase然后将其移回?

I understand that git-svn isn't ready for real world work on Windows but I'd like to recover from this mess it has created. 我知道git-svn还没有为Windows上的真实世界工作做好准备,但我想从它创建的这个混乱中恢复过来。

Best current answer (I don't know if this existed back when this was originally posed): 目前最好的答案(我不知道这是在最初提出时是否存在):

git config core.ignorecase true git config core.ignorecase是的

Then redo the rebase. 然后重做rebase。 It will proceed without error -- and will even properly handle the case change in the filename. 它将继续进行而不会出错 - 甚至可以正确处理文件名中的大小写更改。

This isn't specific to git-svn. 这不是git-svn特有的。 It can happen in a straight 'git rebase'. 它可能发生在直接的'git rebase'中。

I hope that helps the next person.... 我希望能帮助下一个人....

I ran into a similar problem with Git (alone, not even with git-svn) getting very confused about changing the case of filenames when using a case-insensitive Mac filesystem. 我遇到了一个类似的问题,Git(单独,甚至没有使用git-svn)在使用不区分大小写的Mac文件系统时对更改文件名的情况感到非常困惑。 I didn't find a solution to fix the repository on the case-insensitive filesystem, but instead created a new case- sensitive volume in a .dmg file, mounted that, and used Git on that volume instead. 我没有找到在不区分大小写的文件系统上修复存储库的解决方案,而是在.dmg文件中创建了一个新的区分大小写的卷,安装了该卷,并在该卷上使用了Git。

You may find that some of the Git "plumbing" commands might be helpful. 你可能会发现一些Git“管道”命令可能会有所帮助。 For example, git checkout-index has a -f flag to force overwriting of existing files (also use -a with that command otherwise it might not do anything). 例如, git checkout-index有一个-f标志来强制覆盖现有文件(也可以在该命令中使用-a ,否则它可能不会执行任何操作)。 The plumbing commands are generally more powerful (and more dangerous) than the porcelain commands, but may give you the flexibility you need to fix this. 管道命令通常比瓷器命令更强大(也更危险),但可以为您提供解决此问题所需的灵活性。

The same way you always solve this problem under Windows. 与您在Windows下始终解决此问题的方式相同。 You have to rename one of the files, then you can restore the other one. 您必须重命名其中一个文件,然后才能恢复另一个文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM