how to remove a file from repository and history?

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Jun 2 14:41:30 CDT 2008


On Mon, 2 Jun 2008 21:19:06 +0200, Jonas Stein <news at jonasstein.de> wrote:
> I added some large binary files in the past.
> That was a bad idea, as i recreate them often with my source files.
>
> But i was quite new to hg. So i want to
> a) delete the binary files now from the repostitory as it consumes to much
> space in my quota
> b) prevent hg to add them again. (i think .hgignore will work)
>
> Any ideas for (a)?

You can convert your Hg repository to _another_ Hg repository, with a
filemap that excludes the file:

    $ cat my-filemap.txt
    exclude foo/bar/largefile.bin
    $ hg convert --filemap my-filemap.txt old-repo-clone new-repo-clone

Please note that this _modifies_ the history too.  The checksums of all
the changesets derived from the original commit of `largefile.bin' will
change in the process.

Then you can safely store the `old-repo-clone' somewhere, and start
using the new `new-repo-clone' as your main repository.



More information about the Mercurial mailing list