Differences between revisions 2 and 105 (spanning 103 versions)
Revision 2 as of 2009-01-09 11:08:04
Size: 3687
Editor: IsaacJurado
Comment:
Revision 105 as of 2013-09-02 12:53:27
Size: 675
Editor: ChiU75
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Mercurial for Git users =

----
/!\ '''''UNFINISHED, PLEASE DO NOT LINK YET'''''
----

[http://git-scm.com Git] is a very popular DistributedSCM that works very
similarly to Mercurial. However, there are some conceptual differences that may
puzzle the casual Git user when using Mercurial.

In general, Git's feature set is the largest among all [:DistributedSCM:DVCS]
software, but Mercurial can equally cover a great extent of it. This document
tries to show how.


== History model ==

Mercurial's view of history is, just like git's, a [:UnderstandingMercurial:DAG]
or Directed Acyclic Graph of commits. The difference is that, in Mercurial,
''commits'' are called ''changesets'', a rough approximation of the ''tree'' git
concept is the ''manifest'' and there is no notion of ''blobs'' because
Mercurial refers directly to files. Aside from that, the graphical
representation of history is the same in both cases.

They both use the SHA1 result value to identify commits/changesets.
Additionally, Mercurial also provides a '''local''' ascending number for each
revision instead of providing the reverse count notation provided by git (for
example, HEAD~4).


== Branch model ==

Also like in git, Mercurial supports branching in different ways. First and
foremost, each clone of a repository represents a branch; eventually identical
to other clones of the same repositories. This way of branching sometimes
referred as ''heavy branches'' and it works the same for both systems, although
the way is handled differs slightly due to git's notion remote branches; more on
this later.

Then git has its famous ''lightweight branches'', which allow to switch between
development lines within the same clone of a repository. Take the following
history graph as an example:

{{{#!dot
digraph {
    label = "Light branches example";
    rankdir = LR;
    node [shape=box];
    a -> b -> c [dir=back];
    c -> d -> e [dir=back];
    c -> f -> g [dir=back];
    e -> X [dir=back, style=dotted];
    g -> Y [dir=back, style=dotted];
    X [shape=plaintext];
    Y [shape=plaintext];
}
}}}

In git, branches {{{X}}} and {{{Y}}} are simply references to the two heads of
the history. If a commit is appended to {{{e}}} then the reference {{{X}}}
would then point to such commit, like so:

{{{#!dot
digraph {
    label = "Moving reference example";
    rankdir = LR;
    node [shape=box];
    a -> b -> c [dir=back];
    c -> d -> e -> h [dir=back];
    c -> f -> g [dir=back];
    h -> X [dir=back, style=dotted];
    g -> Y [dir=back, style=dotted];
    X [shape=plaintext];
    Y [shape=plaintext];
}
}}}

Mercurial has '''always''' supported these kind of branches, but with a
different name and, somehow in an anonymous way. In Hg, the {{{X}}} and {{{Y}}}
branches are called ''heads'' and, until recently, they had to be referred by
their changeset identifier; either local (number) or global (SHA1 hash).

Since Mercurial 1.1, the BookmarksExtension provides a way to identify (and
follow) a light branch with a symbolic name, similarly to git. The
''bookmarks'' does not perfectly mimic git branches in the case of two bookmarks
pointing to the same head (or two branches referencing the same commit). In
git, a commit only updates the working branch while in Mercurial, a changeset
updates all the bookmarks pointing to it.

BookmarksExtension from Mercurial version 1.2 ([i] to be released) solves this
issue and, thus, gets closer in approaching git's lightweight branches.

Related to these branches, git can also handle some special light branches
called ''remote branches''
People call me Jordon and I was born in North Carolina in the United States - I am a student majoring in Veterinary Medicine and I also run a magnificent site about [[http://blueeye99.com/wiki/index.php/%EC%82%AC%EC%9A%A9%EC%9E%90:DemetriaQ72|Link Building]].The simple reality that lots of people devote rather a great deal of their time every day to link building shows that it is one crucial job. For one, it produces connections in between pages and other websites that send site visitors our means. The most critical reason for constructing links is to help a website attain greater ranks in popular search engines and as an outcome send out lots of traffic its means.

People call me Jordon and I was born in North Carolina in the United States - I am a student majoring in Veterinary Medicine and I also run a magnificent site about Link Building.The simple reality that lots of people devote rather a great deal of their time every day to link building shows that it is one crucial job. For one, it produces connections in between pages and other websites that send site visitors our means. The most critical reason for constructing links is to help a website attain greater ranks in popular search engines and as an outcome send out lots of traffic its means.

GitConcepts (last edited 2020-12-05 18:06:40 by KevinLocke)