Mercurial > hg-website
changeset 160:bb60a4d6a1e3
learning in workflows: Added rollback to the feature clone workflow.
author | Arne Babenhauserheide <bab@draketo.de> |
---|---|
date | Tue, 12 May 2009 14:39:10 +0200 |
parents | 83970c19b495 |
children | 7395ca01d978 |
files | hgscm/templates/workflow_guide.html |
diffstat | 1 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <pre>$ hg log -p -r 3</pre> -<h3>Lone developer with linear history</h3> +<h3>Lone developer with nonlinear history</h3> <h4>Use case</h4> @@ -207,6 +207,8 @@ <h4>Workflow</h4> +<h5>Work in different clones</h5> + <p>First create the feature clone and do some changes</p> <pre>$ hg clone project feature1 @@ -243,6 +245,28 @@ <p>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").</p> +<h5>Rollback mistakes</h5> + +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 <hg>commit</hg> or <hg>pull</hg>: <hg>rollback</hg>. + +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 + +<pre>hg rollback</pre> + +And then redo the commit + +<pre>hg commit -m "message"</pre> + +If you can use the command history of your shell and you added the previous message via <hg>commit -m "message"</hg>, 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 <hg>rollback</hg> 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 <hg>rollback</hg> to undo your last <hg>pull</hg>, if you didn't yet commit aything new. + <h3>Sharing changes</h3> <h4>Use Case</h4>