重新命名不会反映在更改拉动 [英] renaming is not reflected when changes pulled
问题描述
我在Windows上使用git。我有起源裸存储库和两个具有相同文件结构的本地存储库。在firlst本地存储库中,我通过使用`mv git Folder \file.txt folder \file.txt'重命名文件夹来改变文件夹的大小写,并提交重命名。然后推到原点。在第二个本地存储库上,我提出了更改,但未反映该情况。当我看到该文件的日志时,我可以看到它已重命名。没有反映变化的原因是什么?有趣的是,对于我重命名的其他文件夹,更改已反映出来。
I'm using git on windows. I have origin bare repository and two local repositories with the same file structure. On the firlst local repository I changed the case of a folder by renaming with `mv git Folder\file.txt folder\file.txt' and commiting the renaming. Then pushed to the origin. On the second local repository I pulled changes, however the case is not reflected. When I see logs for that file I can see that it was renamed. What could be the reasons for the changes not being reflected? Interestingly, for some other folders that I renamed the changes were reflected.
推荐答案
我不确定它会执行此操作,但尝试使用 HEAD
来更新索引:
I'm not sure it will do the trick but try
Update the index with what's at the
HEAD
:
git read-tree -i HEAD
删除应该重新命名的文件和/或目录:
Remove files and/or directories which should become renamed:
del blah
rmdir foo
强制创建工作树文件,
Force creation of the work tree files from their version at the index:
git checkout-index -a -f
将来请注意,Git不幸并不适合您的情况。这是可以理解的:在Windows上,NTFS不区分大小写,而保留病例,并且FAT既不区分大小写又不区分大小写。在IOW中,Git可能就这个问题展现出一种完美的行为:一方面它应该在提交的树和'foo / bar中对待'FoO / bAr.tXt'。文件系统上的txt表示相同的文件,另一方面它们应该表示不同的东西?这不会奏效,我能想象的唯一解决方案就是一些特定于Windows的hack,比如 git checkout-index --fix-work-tree-name-casing
重命名工作树实体以匹配索引。
In the future be aware that Git is unfortunately does not deal well with your case. And it's understandable: on Windows, NTFS is case insensitive while case-preserving, and FATs are both case-insensitive and not case-preserving. IOW, there seems to be just no sane behaviour which Git could exhibit with regard to this issue: on one hand it should treat 'FoO/bAr.tXt' in the commit's tree and 'foo/bar.txt' on the file system to mean the same file, and on the other they should mean different things? It's not gonna work, and the only solution I could envision is some Windows-specific hack like git checkout-index --fix-work-tree-name-casing
which would actually rename the work tree entities to match the index.
更新:,正如已经建议其他, git reset --mixed HEAD
可以用来代替 git read-tree
。
Update: as has been advised elsewhere, git reset --mixed HEAD
can be used instead of git read-tree
.
这篇关于重新命名不会反映在更改拉动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!