Search code examples
fossil

How to undo an old change in fossil?


I have the following timeline:

=== 2016-02-19 ===
15:07:30 [61c9483b55] *CURRENT* ...
08:41:52 [6a8317cb5b] ...
=== 2016-02-18 ===
16:14:27 [469c4301dd] ...
15:59:42 [e0fb6a50c0] ...
15:58:15 [161561b17d] ...
=== 2016-02-11 ===
16:23:13 [770f95b9e4] ...
15:31:35 [a4c6f00a23] ...
14:59:15 [7ea7e751da] ...
14:57:13 [3adb8e5b4f] ...
11:59:13 [24558955aa] ...
=== 2016-02-05 ===
15:50:20 [7a760541b0] ...
10:27:18 [6630ce2f8c] ...
09:51:32 [d146724770] ...
=== 2016-01-29 ===
13:20:48 [4a30407708] ...
08:09:54 [e29b22f7e2] ...
--- line limit (20) reached ---

During the revision 7a760541b0 and 24558955aa a bug has been introduced, which I want to fix by reverting the change. But I do not want to revert to the version 24558955aa, because after that many good changes have been made.

How can I undo just those changes done by 24558955aa?


Solution

  • What you're looking for is a subfeature of fossil merge. Backing out a change is basically the inverse of cherrypicking this change and indicated by the --backout option, e.g.:

    fossil merge --backout 24558955aa
    

    You will still have to commit the new revision after the merge (and, ideally, should review the code to verify that the bug has indeed been undone). Note that conflicts may arise (because of other changes that happened in the meantime); these can be resolved in the usual fashion.