Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

delete files in history to save some space in mercurial

Tags:

mercurial

ok, when I was young, I put severial big files(like resource file, dll, etc..) in my mercurial repos. and I found the size of it is so big that I cannot easily push it into bitbucket,

any way to delete this files history EASILY?

I put all those files in /res and /dll path.

edit:

this is a solution, but it will delete part of the history, so maybe there is a better solution. Mercurial Remove History

like image 714
linjunhalida Avatar asked Oct 13 '10 01:10

linjunhalida


1 Answers

Your best bet is to use the convert extension, but warning you'll end up with a totally different repo. Every hash will be different and every person who cloned will need to delete their clone and re-clone.

That said, here's what you do:

Create a filemap file named filemap.txt containing:

exclude res
exclude dll

and then run this command:

hg convert --filemap filemap.txt your-source-repository your-destination-repository

For example:

hg convert --filemap filemap.txt /home/you/repos/bloatedrepo /home/you/repos/slenderrepo

That gets you a whole new repo that has all of your history except the history of any files in /res and /dll, but again it will be a new, unrelated repo as far as mercurial (and bitbucket) are concerned.

like image 84
Ry4an Brase Avatar answered Nov 10 '22 15:11

Ry4an Brase