How do you remove big files from history in mercurial?

不想你离开。 提交于 2019-11-30 10:45:50

问题


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.

Is this possible with mercurial?


回答1:


Check out the convert extension, particularly the --filemap option.

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

Then convert the repo:

hg convert srcrepo destrepo --filemap <map>

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

Just add the --splicemap <nonexistent file> option to fix the problem.



来源:https://stackoverflow.com/questions/10103227/how-do-you-remove-big-files-from-history-in-mercurial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!