Reputation: 4098
I have, by mistake, added a large file to hg repo. I then stripped the changeset, but noticed that the repo size (.hg folder size) hasn't decreased. I've done hg convert <old_repo> <new_repo>
, and the size did decrease. So it sort of works for me, but I'd like to understand the concept.
What is the purpose of keeping the files in the repo if they are not in history anymore?
Is my method of deleting files from the history the best practice (forgetting that I shouldn't be adding them in the first place)?
Upvotes: 4
Views: 195
Reputation: 776
I suspect that this may be the cause:
When you strip a changeset, mercurial will create a bundle of the change and place it in .hg/strip-backup directory. This allows you recover the changeset using the hg unbundle command.
This can make the size of .hg appear unchanged. This file can be deleted if you do not intent to restore from it and the size of .hg should reflect this.
Note: strip will print the name of the bundle file it creates. You can also tell strip to not create the bundle file with the --no-backup option.
Upvotes: 3