Whygitisbetterthan.com, some advocacy from GitHub

Teemu Likonen tlikonen at iki.fi
Tue Dec 2 11:37:58 GMT 2008


Elliot Murphy (2008-12-01 16:11 -0500) wrote:

> I don't understand why git is supposed to be better than bzr at cheap
> local branching, perhaps this is a case of not having a shared repo by
> default causes a surface evaluation to make git look better here.

I don't comment which one is better but being cheap in Git's context
means that branches don't take disk space nor otherwise consume
resources. Branches in Git are just pointers to a commit. Creating a
branch is essentially just creating a single 41-byte file to
.git/refs/heads directory; it contains the SHA1 code of the HEAD commit
of the branch. In practice, Git usually also creates a reflog entry for
the operation so branch-creation also creates another file which takes
about 160 bytes more disk space. Anyway, creating branches is always
cheap and fast, no matter how big the repository is.

Branch-switching (git checkout) may take a couple of seconds if the two
branches are radically different and there are lots of files in the
repository. For example, with my machine in Linux kernel repository "git
checkout master~5" takes 0.6 seconds but "git checkout master~5000"
takes 12 seconds. Short diffstat between the example branches:

    $ git diff --shortstat master~5..master
     29 files changed, 421 insertions(+), 158 deletions(-)

    $ git diff --shortstat master~5000..master
     23666 files changed, 2550919 insertions(+), 1671389 deletions(-)



More information about the bazaar mailing list