Mercurial: Revert a single hunk

前端 未结 3 1801
既然无缘
既然无缘 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:14

    Actually mercurial refers to "chunks", at least in the Shelve tool. Which brings me to favorite way to revert them (and favorite features of TortoiseHg).

    Just move the chunks you want to revert onto a shelf you create solely with the intention to delete. This works really well as long as the chunks are identified as you need them to be. If not, you've got no choice but to do something manually.

    If you use TortoiseHg Workbench or VisualHg, it is very easy to get to the Shelve tool: there is a button next to the diff mode toggle buttons. If you are not familiar with shelves, do yourself a favor and start using it. It has saved me much aggravation when I've forgotton to commit early, or decided to leave out experimental code from a commit.

提交回复
热议问题