I have committed some files to a mercurial repository that I want to permanently remove from the repository history. Its jus开发者_运维百科t test output in a directory that I hadn't added to .hgignore. I wouldn't normally care, but the file paths are very long and when I try to clone to a windows machine it aborts due the file path length.
I've read in a few places that its not possible to remove history. Is there any other workaround?
You can remove files from the history completely, but by doing so, you're basically creating a new repository, unrelated to the previous one (so any clone it has will no longer be a clone). The easiest way is to use convert extension:
hg convert -d hg --filemap filemap repo new-repo
The filemap
file allows you to specify which files should be skipped over when creating the new history:
exclude fileA
exclude fileB
You can find more information on the Mercurial wiki: convert extension, FAQ entry.
精彩评论