Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accidentally committed a large amount of raw data in Mercurial, how do I keep it from overloading my bitbucket repository?

I copied a large amount of data from my labs file server to my laptop, then accidentally committed it to the Mercurial repository I'm using to back up my thesis.

Now I have 200+ MB of data I don't need taking up space on my hard disk, even after I've deleted the files. This isn't really a problem, but the bitbucket repository I sync to only gives me 1 GB of space, which I will need for my data.

Stupidly I then deleted the files and committed again, so I can't just use rollback as described in https://stackoverflow.com/a/3290523/961959 without creating a new repository and having to reset up everything with bitbucket.

Is there a way I can fix this, so I don't waste a quarter of my repository space? Can I rollback the last 2 commits I did?

like image 272
Canageek Avatar asked Dec 11 '11 19:12

Canageek


1 Answers

You can:

  1. Use hg strip to remove the changeset where you've added the files and all of its descendants (note that this will obliterate them completely, so only do it if these files are the only thing committed during this time).
  2. Import those changesets to MQ and edit them.
  3. Use hg convert from Mercurial to Mercurial with --filemap option.
  4. Clone your repository up to faulty changeset and push from this one instead, as described in FAQ.
like image 141
Cat Plus Plus Avatar answered Sep 24 '22 02:09

Cat Plus Plus