How to get rid of big binary files buried in my repository's history

Shridhar Daithankar ghodechhap at ghodechhap.net
Wed Feb 25 00:40:18 CST 2009


On Wednesday 25 February 2009 10:41:22 Tim Molendijk wrote:
> A couple of commits ago I introduced a big video file into the repository.
> At first I didn't see the harm, until I pushed to my code host which took
> quite a while (obviously). Then I needed to change the path of the file
> within the repository and even though I used 'hg rename', upon pushing I
> noticed the complete video file (which hadn't changed apart from its
> location) was uploaded again. Then I cloned my repository from my code host
> to my web server. This took forever, which made me realize that the video
> file has been stored in 'history' (.hg) twice, and it is there to stay.
>
> I very much don't like this situation, but how can I truly get rid of the
> file? If I simply remove it, it remains part of a past changeset, so every
> time I make a new clone of the repository it will need to be downloaded
> again (twice in my case). If I update back to a revision before I added the
> file I lose all my changes that followed, and I cannot see how I could
> merge these changes back in without merging back in the video file as well.

- Use "clone -r" locally, to get a copy of repo, sans the video file, 
- redo the changes to the new clone(since it is only couple of commits since 
the video file is introduced), except the video file 
- remove the original big repo.

HTH

-- 
 Shridhar


More information about the Mercurial mailing list