Forgeting/removing a revision from Mercurial repository
This happens to me a lot of times. I make some edition...
$ nano module1.c
...run some tests...
$ make test
OK
...and, since the test passed, I commit it:
$ hg commit -m "Bug #123 corrected"
Then I start another functionality, editing some test:
$ nano test/module2.c
I want to run the tests, and press Control-P (or ↑) to execute make test开发者_C百科
. Unfortunately, however, I commit the last message again:
$ hg commit -m "Bug #123 corrected"
So, Is there a way remove this last commit from my Mercurial repository without losing the edits I have made in test/module2.c
?
See hg help rollback
. Read it carefully, it's dangerous.
Warning: if you continue the false efficiency of letting your fingers get ahead of your brain, hg rollback
will bite you much harder than hg commit
. If you want to run make tests
a lot and can't wait .3 seconds for visual data to reach your prefrontal cortex, make yourself an mt
alias rather than blindly leaping into your command history.
精彩评论