Jezen Thomas
Jezen Thomas

Reputation: 13800

Remove files from HG Outgoing

When I run hg outgoing -v I see the outgoing changeset and all files it includes. I forgot to set Mercurial to ignore images, and I've realised that my outgoing contains images. I'd like to remove all .jpg files from outgoing.

I did another hg commit after the one that added the images, so hg rollback doesn't seem to be an option. I've tried running hg push, but I aborted since it took too long to finish (because of the images). Can I fix this without starting the repository again?

Upvotes: 1

Views: 588

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328536

Yes. In your case, the most simple approach is probably:

  1. Don't panic. If anything goes wrong, try the following steps again :-)
  2. Clone your repo locally (just use the broken version as "url") and use -r to get everything but the commit that you don't want. You can use hg log on the new repo to make sure you have what you want.
  3. Make sure the images don't get committed -> edit .hgignore, etc.
  4. Commit that
  5. Export the last commit (use hg export -r ...) and apply it to the "good" clone (hg import)
  6. Move the broken repo somewhere else (just in case you still need it)
  7. Continue to work on the new, clean copy. You might need to add the default push path to hgrc again. Just compare the content of the .hg/hgrc files of your broken and good repo.

Upvotes: 1

Related Questions