Reputation: 2821
I'm new to Mercurial and what I'm starting to realize is that my basic workflow may not be the most efficient way of working because I perform commits so frequently and for feature improvements that are so small that when I need to find some earlier step to revert to, it is extremely difficult.
Here's what I do after I have a project set up in Mercurial and have already completed my first commit.
hg commit -m "improvement A works"
hg commit -m "improvement B works"
hg commit -m "feature A works"
If I find a mistake that was made in "improvement A", I open up history (with the Netbeans Mercurial visual plugin) and copy and paste some of the code back into my current version and start again from there.
This doesn't seem like a good system - I would appreciate any suggestions.
Upvotes: 5
Views: 1717
Reputation: 63734
You could isolate the changes for the improvements into branches maintaining a stable trunk.
Take a look at Branch wiki page.
Workflow pattern would be:
If you find a mistake you can abandon the branch (or correct the bug in the branch prior to merging back into trunk).
Upvotes: 7
Reputation: 332
I disagree with the branches approach. If no parallel development is needed, why add the complexity of branches? There's nothing wrong with small 'checkpoint' commits. Tags can be used to point to important commits, which might be more clear.
Upvotes: 4
Reputation: 8724
I agree with Jon that branches are the solution, but I would create branches for features rather than for the individual improvements that make up a feature. The workflow pattern would then be this:
If you find a mistake in an improvement A of feature A, instead of starting over, you switch to the feature A branch and do the following:
Upvotes: 10