~jan0sch/darcs-book

Showing details for patch 2ec87d74fab4bfbfa0e04562b9fec1dfa188b7cc.
2018-06-27 (Wed), 1:45 PM - - 2ec87d74fab4bfbfa0e04562b9fec1dfa188b7cc

add chapter 2

Summary of changes
1 files added
  • en/02-getting-started.md
diff -rN -u old-darcs-book/en/02-getting-started.md new-darcs-book/en/02-getting-started.md
--- old-darcs-book/en/02-getting-started.md	1970-01-01 00:00:00.000000000 +0000
+++ new-darcs-book/en/02-getting-started.md	2024-11-24 08:00:50.625103782 +0000
@@ -0,0 +1,126 @@
+Getting started
+===============
+
+I see that you are still here, cool! Before we can really get our hands dirty
+let's get familiar with some of the terminology you will encouter when you are
+using `darcs`.
+
+Terminology
+-----------
+
+It's somewhat important to speak the same language when we are talking about a
+topic like version control so we need to establish a common vocabulary first.
+Don't worry, it won't be much and I'll be introducing new terms as we are going
+along. But here are the basic terms you need to know.
+
+* Working Directory
+
+  This is where our project files reside, all work is done here.
+
+* Repository
+
+  We already talked a bit about this but let's keep our most basic terms in one
+  place. A repository is a place where we store information about our project
+  history. As our working directory changes through time we can record patches
+  that represent those changes and store them in our repository together with
+  additional information like, what changed, who did the changes and when.
+
+* Change
+
+  A change is a logical modification that we have done to our project. These can
+  be something like adding or removing a file, changing the content of a file,
+  moving a file from one place to another etc.
+
+* Patch
+
+  A patch is how we represent a change. Whenever we want to remeber a change we
+  do this be recording a patch. A patch takes a repository from one state to
+  another.
+
+**The state of a repository is defined by a set of changes.**
+
+Whoa, hold on a second! That sounds pretty mathematical, and that's because it
+is. But don't worry, the ideas we are dealing with here can be expressed in
+simple ways. In mathematics we have the notion of a set. Something like
+*{1,2,3}* denotes a set containing those three numbers, *1*, *2* and *3*. When
+we are talking about sets the order of their elements do not matter. So we can
+think of *{1,2,3}* and *{3,1,2}* as being different denotions of the same set.
+In `darcs` the order of the changes do not matter, when you have the same set of
+changes as someone else you will both arrive at the same repository state, it
+doesn't matter in which order you acquired them.
+
+`darcs` stores changes as a sequence of patches. Let's look at a simple example.
+
+Let `A` be a change that adds a file `foo` to our project and let `B` be a
+change that adds a file `bar` to our project. These two changes are independent
+of each other so we can pull them into our repository in any order. So adding
+`A` and then `B` to our repository gets us to the same place as adding `B` and
+then `A`. Maybe you remember this from school where you learn that 1 + 2 is the
+same thing as 2 + 1. `darcs` applies this concept to patches and it's called
+**commutation** and it vital to the way `darcs` works. In our example we say
+that "`A` and `B` commute" which basically means that the patch sequence `AB`
+(first apply `A` than `B`) gets us to the same place as the sequence `BA`.
+
+Using the `darcs` command line interface
+----------------------------------------
+
+`darcs` is used via a command line interface, that means you a interacting with
+is by issuing commands on the shell. If you already used other version control
+systems this might worry you a bit, but don't be afraid. `darcs` has a very
+friendly user interface that leaves little room for unpleasant surprises. One
+major feature is that most of the commands are interactive. Let me give you an
+example.
+
+Let's say I want to `rollback` (it's not important to understand what that means
+exactly, we'll get to that later) a change, to do that I would simply issue the
+`darcs rollback` command and `darcs` would present me with a prompt similar to
+this:
+
+```
+$ darcs rollback
+patch eec36aaa61a4fad924657cd86624ba162991860d
+Author: raichoo
+Date:   Mon Jun 18 12:32:34 CEST 2018
+  * fish: add move color to darcs prompt
+Shall I rollback this patch? (1/253)  [ynW...], or ? for more options:
+```
+
+I can answer with `y` for "yes" and `n` for "no" and `darcs` will proceed to the
+next patch. If I want to know what options are available to me I can simply hit
+`?` and in the case of `rollback` I will be presented with the following set of
+options.
+
+```
+How to use rollback:
+y: rollback this patch
+n: don't rollback it
+w: wait and decide later, defaulting to no
+
+
+s: don't rollback the rest of the changes to this file
+f: rollback the rest of the changes to this file
+
+v: view this patch in full
+p: view this patch in full with pager
+l: list all selected patches
+x: view a summary of this patch
+
+d: rollback selected patches, skipping all the remaining patches
+a: rollback all the remaining patches
+q: cancel rollback
+
+j: skip to next patch
+k: back up to previous patch
+g: start over from the first patch
+
+?: show this help
+
+<Space>: accept the current default (which is capitalized)
+```
+
+Great! Everything you need, right at your fingertips! You don't need to reach
+for a reference or deep dive into the documentation to get the job done.
+
+`darcs` also comes with a built-in help system. So if you want to know what
+`rollback` does you can simple issue `darcs help rollback` or `darcs rollback
+--help` and there you go, you get the manual for the `rollback` command.