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

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

问题描述

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

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

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

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书:

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天全站免登陆