Mercurial: Revert a single hunk

前端 未结 3 1810
既然无缘
既然无缘 2021-02-07 06:43

How do I revert a single hunk in Mercurial, similar to the way it\'s done in darcs, i.e. it asks me for each hunk and file whether I want to revert it? Is it possible using Tor

3条回答
  •  名媛妹妹
    2021-02-07 07:03

    The record extension is inspired by darcs record. It will allow you to add only specific hunks to the next commit, i.e., the opposite of what you want. But you could add all hunks except the one you want to revert and then do a hg revert to revert it. A little backwards, I know... :-)

    You could also do hg diff > patch; hg revert, edit patch to delete the hunk and do hg import --no-commit to reappy the patch. That is likely faster, but requires you to manually edit the patch. I've had great success with the Emacs diff-mode, but since you ask about TortoiseHg you might not want to use Emacs.

提交回复
热议问题