~jan0sch/darcs-book
Showing details for patch c68850b7110a36cb285860c53f20e088f6dcabef.
diff -rN -u old-darcs-book/en/04-happy-little-accidents.md new-darcs-book/en/04-happy-little-accidents.md --- old-darcs-book/en/04-happy-little-accidents.md 2024-11-23 23:19:02.623298829 +0000 +++ new-darcs-book/en/04-happy-little-accidents.md 2024-11-23 23:19:02.623298829 +0000 @@ -2,13 +2,13 @@ ====================== Most of us are human, therefore we are bound to make mistakes. Version control -is a tool that keeps us safe, well at least our code. +is a tool that keeps us safe, well at least our projects. -Imagine you have a piece of code that is working perfectly fine but now, for +Imagine you have a piece of code that is working perfectly fine, but now for some reason, you need to change it. If you are not using version control you might have to backup all of your code before trying anything new. Things like that can keep us from trying out better approaches because we might lose -precious work. With version control this is a none issue, you can always go +precious work. With version control this is a non issue, you can always go back to a previous state and start over. Or you can branch off and try something completely different that might replace your existing project with a new and improved version. It's a lot less stressful than the manual copy and paste @@ -22,7 +22,7 @@ ----------------- The most obvious thing that might go wrong in your development process is that -you have a lot of changes in your working directory and you have decided that +you have a lot of changes in your working tree and you have decided that they don't make the cut. You want to get rid of them. Here's an example. Imagine you are writing a novel and some time light at night @@ -38,7 +38,7 @@ might have come across them, I certainly did, and they are no fun. In a situation like this `darcs revert` is exactly what you want. It allows you -to restore the state of the working directory as if you didn't make any changes +to restore the state of the working tree as if you didn't make any changes since the last record. ``` @@ -60,10 +60,10 @@ No changes! ``` -Done! `darcs revert` will prompt you for any change, asking whether it should -`revert` the change or not. Keep in mind that you can always hit `?` if you are -unsure about what the available options are. Here's a look at what you can do -when reverting. +Done! `darcs revert` will prompt you for any unrecorded change, asking whether +it should `revert` that change or not. Keep in mind that you can always hit `?` +if you are unsure about what the available options are. Here's a look at what +you can do when reverting. ``` How to use revert: @@ -94,10 +94,12 @@ <Space>: accept the current default (which is capitalized) ``` -If you just want to get rid of everything in your working directory without -being prompted interactively you can just issue `darcs revert --all` or the -short hand `darcs revert -a` and `darcs` will `revert` all the unrecorded -changes in your working directory. +If you just want to get rid of all the unrecorded changes you made to your +working tree without being prompted interactively you can just issue `darcs +revert --all` or the short hand `darcs revert -a` and `darcs` will `revert` all +the unrecorded changes in your working tree. Just like with `record` you +can also pass a list of one or more files to `revert` to specify which the files +for which you would like to `revert` your changes. Unrevert -------- @@ -145,7 +147,7 @@ So, a couple of weeks later we figure that maybe this is just way too much joy and we decide to roll back the change. We do that by using `darcs rollback` -which takes some changes and applies their inverse to the working directory. +which takes some changes and applies their inverse to the working tree. Just like `log` `rollback` can take a `-p` flag to specify a pattern for selecting matching patches. I know that the package name contains the word "joy" so I'm using that. @@ -162,12 +164,12 @@ +happy happy joy joy Shall I rollback this change? (1/1) [ynW...], or ? for more options: y Do you want to Rollback these changes? [Yglqk...], or ? for more options: y -Changes rolled back in working directory +Changes rolled back in working tree $ darcs whatsnew hunk ./story.txt 2 -happy happy joy joy ``` `rollback` does not create any new patches, it just applies the inverses of the -changes you have selected to your working directory, it's up to you to record a +changes you have selected to your working tree, it's up to you to record a new patch from them.