# HG changeset patch # User Arne Babenhauserheide # Date 1242131950 -7200 # Node ID bb60a4d6a1e3a6f53e0dc2a11ceb1e935e182c47 # Parent 83970c19b4952a19988471ffa7deb755c98b4ead learning in workflows: Added rollback to the feature clone workflow. diff -r 83970c19b495 -r bb60a4d6a1e3 hgscm/templates/workflow_guide.html --- a/hgscm/templates/workflow_guide.html Tue May 12 11:09:24 2009 +0200 +++ b/hgscm/templates/workflow_guide.html Tue May 12 14:39:10 2009 +0200 @@ -100,7 +100,7 @@
$ hg log -p -r 3
-

Lone developer with linear history

+

Lone developer with nonlinear history

Use case

@@ -207,6 +207,8 @@

Workflow

+
Work in different clones
+

First create the feature clone and do some changes

$ hg clone project feature1
@@ -243,6 +245,28 @@
 
 

Note: You also have to commit after a merge when there are no conflicts, because merging creates new history and you might want to attach a specific message to the merge (like "merge feature1").

+
Rollback mistakes
+ +Now you can work on different features in parallel, but from time to time a bad commit might sneak in. Naturally you could then just go back one revision and merge the stray error, keeping all mistakes out of the merged revision. However, there's an easier way, if you realize your error before you do another commit or pull: rollback. + +Rolling back means undoing the last operation which added something to your history. + +Imagine you just realized that you did a bad commit - for example you didn't see a spelling error in a label. To fix it you would use + +
hg rollback
+ +And then redo the commit + +
hg commit -m "message"
+ +If you can use the command history of your shell and you added the previous message via commit -m "message", that following commit just means two clicks on the arrow-key "up" and one click on "enter". + +Though it changes your history, rolling back doesn't change your files. It only undoes the last addition to your history. + +But beware, that a rollback itself can't be undone. If you rollback and then forget to commit, you can't just say "give me my old commit back". You have to create a new commit. + +Note: Rollback is possible, because Mercurial uses transactions when recording changes, and you can use the transaction record to undo the last transaction. This means that you can also use rollback to undo your last pull, if you didn't yet commit aything new. +

Sharing changes

Use Case