您如何从历史记录中删除大文件? [英] How do you remove big files from history in mercurial?
问题描述
我刚刚创建了一个由其他仓库的异构生态系统创建的商品仓库.在将其发布给我的同事之前,我想尽可能地对其进行清理.为此,我想从历史记录中完全删除一些大的旧文件(假设它们根本不存在),因此回购将更小.
I have just created a mercurial repo created from a heterogeneous ecosystems of other repos. Before I publish it to my co-workers, I want to clean it as much as possible. To this end, I'd like to entirely remove a few big old files from history (pretend they never existed), so repo will be smaller.
水星病有可能吗?
推荐答案
签出convert
扩展名,尤其是--filemap
选项.
Check out the convert
extension, particularly the --filemap
option.
通过在mercurial.ini
中添加以下内容来启用:
Enable by adding the following to mercurial.ini
:
[extensions]
convert =
创建要排除的文件映射:
Create a map of files to exclude:
exclude path/to/file1
exclude path/to/file2
然后转换存储库:
hg convert srcrepo destrepo --filemap <map>
请注意,Mercurial 2.1.1中存在一个错误,导致上述命令出错:
Note there is a bug in Mercurial 2.1.1 causing an error with the above command:
initializing destination destrepo repository
abort: invalid mode ('r') or filename
只需添加--splicemap <nonexistent file>
选项即可解决该问题.
Just add the --splicemap <nonexistent file>
option to fix the problem.
这篇关于您如何从历史记录中删除大文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!