Changes between Version 20 and Version 21 of GitForDarcsUsers


Ignore:
Timestamp:
Aug 14, 2008 11:34:16 PM (7 years ago)
Author:
nominolo
Comment:

Start a "Git Concepts" section

Legend:

Unmodified
Added
Removed
Modified
  • GitForDarcsUsers

    v20 v21  
    55
    66Also see "General Notes" below for features present in Git but not in Darcs.
     7
     8= Git Concepts =
     9
     10In order to understand some commands it is important to compare both Git's and Darcs' internal model.  A Darcs repository is a collection of patches with some dependencies between them.  The working directory is what you get when you apply all those patches in a valid order.
     11
     12Git on the other hand tracks states of the working directory.  Each commit refers to a particular "version" of the working tree.  So far, this is just a different view of the same thing, in fact, Git internally stores some sort of diffs for space efficiency.  The important difference is that a Git commit also remembers which version we make our patch against, i.e., the parent of the new commit.  Several commits can have the same parent or multiple parents, in which case they are merges.  As a result, a Git repository forms a directed acyclic graph.  These are often depicted in ASCII art like this:
     13{{{
     14          o---o---o---o
     15         /             \
     16o---o---A---o---o---o---B---o
     17}}}
     18After commit "A" two developers (or the same developer in different branches) performed different commits on top of the same original version.  The "B" commit is a merge.  If the two branches contained conflicting changes "B" would contain its resolution.
     19
     20== Branches ==
     21
     22A '''branch''' in Git is now merely ''a pointer to a commit''.  For example, a typical situation is this:
     23{{{ 
     24                o---o---o <-- feature1
     25;
     26          o---o <-- develop 
     27;
     28o---o---A---o---o---o <-- master
     29}}}
     30Here we have three branches "feature1", "develop", and "master".  "master" is the default branch that is created automatically, when you initialise a new Git repository.  Some commands also default to the master branch for certain actions, but otherwise it is not special in any way.
     31
     32Note that Git branches all exist in the same repository.  You can have several physical clones of the same repository like in Darcs, but it is often more convenient to work with multiple branches in the same directory.  The most important commands for working with branch are {{{git checkout}}} and {{{git branch}}}, see below.
    733
    834= General Settings =