I am using Eclipse.
This happens very often when we develop such code (suppose that it develops sequentially, from top to bottom):
Part 1 (*) Part 2 Part 3 Part 4 (*) Part 5
But we just realized that parts 1 and 4 (marked with (*)) are wrong, and the rest are just beautiful. The question is, how can we cancel only these two parts (1 and 4) without canceling the rest?
If we could cancel selectively, it was great. Note that simply returning the code to version 1 loses parts 2, 3, and 5, which are the correct parts and must remain in the code. Also note that usually these parts are mixed in one or two code blocks (not in separate blocks).
Example:
Part 1: Add method f1(x, y) and move some code from main() to f1()
The current approach I'm using is:
- Save a copy of the latest version somewhere (for example, in a temporary text file), then undo the action to part 1 and add these correct parts from the temporary text file to the source code.
- Manually comparing different versions and resolving conflicts.
Does anyone think of an easier but more automatic way of choosing which changes to undo and which to save?
Alisa source share