有没有办法删除 Mercurial 中单个文件的历史记录? [英] Is there a way to remove the history for a single file in Mercurial?

查看:17
本文介绍了有没有办法删除 Mercurial 中单个文件的历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我已经知道答案了,但我还是想问:

I think I already know the answer to this but thought I would ask anyway:

我们有一个文件被添加到 Mercurial 存储库中,其中包含敏感信息.有没有办法在不删除整个 repo 的情况下删除该文件及其更改历史记录?

We have a file that got added to a Mercurial repository with sensitive information in it. Is there any way to remove that file along with its change history without removing the whole repo?

推荐答案

不,你不能.阅读应该有的更改从来没有关于它的红皮书的部分;尤其是那些敏感的变化呢 小节,其中包含本段:

No, you can't. Read the changes that should have never been section of the mercurial red book about it; and particularly the what about sensitive changes that escape subsection, which contains this paragraph:

Mercurial 也没有提供方法完全制作文件或变更集从历史中消失,因为有没有办法强制执行它的消失;有人可以很容易地将他们的 Mercurial 副本修改为忽略此类指令.此外,即使 Mercurial 提供了这样的能力,一个根本没有的人拉了一个使这个文件消失"变更集不会受到它的影响,网络爬虫也不会访问错误的时间、磁盘备份或其他机制.确实,没有分布式修订控制系统可以使数据可靠地消失.提供这种控制的错觉很容易给人一种虚假的安全感,并成为比根本不提供更糟糕.

Mercurial also does not provide a way to make a file or changeset completely disappear from history, because there is no way to enforce its disappearance; someone could easily modify their copy of Mercurial to ignore such directives. In addition, even if Mercurial provided such a capability, someone who simply hadn't pulled a "make this file disappear" changeset wouldn't be affected by it, nor would web crawlers visiting at the wrong time, disk backups, or other mechanisms. Indeed, no distributed revision control system can make data reliably vanish. Providing the illusion of such control could easily give a false sense of security, and be worse than not providing it at all.

mercurial 通过 backout 命令支持恢复已提交更改的常用方法(同样,mercurial book:处理已提交的更改) 但信息不会从存储库中消失:因为你永远不知道到底是谁克隆了您的存储库,这会给您带来虚假的安全感,如上所述.

The usual way to revert committed changes is supported by mercurial through the backout command (again, mercurial book: dealing with committed changes) but the information does not disappear from the repository: since you never know who exactly cloned your repository, that would give a false sense of security, as explained above.

这篇关于有没有办法删除 Mercurial 中单个文件的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆