I commited (not pushed) a lot of files locally (including binary files removing & adding…) and now when I try to push it takes a lot of time. Actually I messed up my local repo history.
How could I avoid this mistake in the future ? Can I transform a set of local revision 1->2->3->4 to 1->2 with 2 being the final revision of the local clone ?
edit: since I was in hurry I started a new remote repo from scratch with revision 4. In the future I will go with the marked answer as it seems easier but I will dig other solutions to see the truth. Thx for your support.
Mercurial history is immutable, you can’t delete using the normal tools. You can, however, create a new repo without those files:
that takes only revisions zero and one from the old repo and puts them into a new repo. Now copy the files from revision four into the new repo and commit.
This gets rid of those interstitial changesets, but any repo you have out there in the wild still has them, so when you
pullyou’ll get them back.In general once you’ve pushed a changeset it’s out there and unless you can get everyone with a clone to delete it and reclone you’re out of luck.