忘记/从 Mercurial 存储库中删除修订
这种情况在我身上发生过很多次。我做了一些版本...
$ nano module1.c
...运行一些测试...
$ make test
OK
...并且,由于测试通过了,我提交它:
$ hg commit -m "Bug #123 corrected"
然后我启动另一个功能,编辑一些测试:
$ nano test/module2.c
我想运行测试,然后按 < kbd>Control-P(或↑)执行make test
。然而不幸的是,我再次提交了最后一条消息:
$ hg commit -m "Bug #123 corrected"
那么,有没有办法从我的 Mercurial 存储库中删除最后一次提交,而不丢失我在 test/module2.c
中所做的编辑?
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
. 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
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅
hg 帮助回滚
。请仔细阅读,这很危险。警告:如果你继续让你的手指领先于你的大脑的错误效率,
hg rollback
会比hg commit
更严重地咬你。如果您想经常运行make test
并且不能等待 0.3 秒视觉数据到达您的前额皮质,请为自己创建一个mt
别名,而不是盲目地跳入您的命令历史记录。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 thanhg commit
. If you want to runmake tests
a lot and can't wait .3 seconds for visual data to reach your prefrontal cortex, make yourself anmt
alias rather than blindly leaping into your command history.