简体   繁体   English

取消跟踪文件,而不会从您和其他人的文件系统中删除它们?

[英]Untracking files without them being deleted from yours AND OTHERS' file system?

I used hg forget <files> to untrack some files without them being deleted from my file system like using hg rm <files> does. 我使用hg forget <files>取消跟踪某些文件,而不会像使用hg rm <files>那样将其从文件系统中删除。 I committed the change and running hg status listed these files as being untracked ? <files> 我已提交更改,并且正在运行的hg status将这些文件列出为未跟踪? <files> ? <files> as expected. ? <files>如预期。 I then pushed the changeset to our remote repository, someone else pulled and updated, and mercurial deleted these files from their file system! 然后,我将变更集推送到我们的远程存储库,其他人进行了拉动和更新,然后从他们的文件系统中删除了这些文件!

Why doesn't Mercurial recognize these these files as being untracked with hg forget on someone else's copy of the repository the same way it does in the copy the changes originated? Mercurial为什么不将这些文件识别为未跟踪,而在其他人的存储库副本上却hg forget了这些更改,就像在副本中所做的一样?

Is their another way of untracking files without them being deleted from anybody's file system? 他们是在不从任何人的文件系统中删除文件的情况下取消跟踪文件的另一种方法吗?

Both Git and Mercurial have the same issue here: You have some commit O (an old one) in which there is a file F . Git和Mercurial在这里都有相同的问题:您有一些提交O (旧的提交),其中有文件F。 Now you update from O to new commit N , which says "there is no file F ". 现在,您从O更新到新的提交N ,它说“没有文件F ”。

What should the version control system do? 版本控制系统应该做什么? Well, that depends on why F was removed, doesn't it? 好吧,这取决于为什么要删除F ,不是吗? If we removed F because it was used before, but is now useless clutter, it should be removed. 如果我们删除F是因为以前使用过它,但是现在变得毫无用处,则应该将其删除。

So, why is removing no-longer-used correct but keeping accidentally-committed also correct? 那么,为什么要删除no-longer-used正确但保留accidentally-committed也正确呢? And how should the VCS know which of these two is meant, given that all it can see is that commit O has both no-longer-used and accidentally-committed , while commit N has neither file? 又应该如何在VCS知道这两个的意思,因为所有能看到的是,提交O具有两个no-longer-used accidentally-committed ,而提交N有没有文件?

(Neither Git nor Mercurial have a good answer to this, as far as I know.) (据我所知,Git和Mercurial都没有一个好的答案。)

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

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