News for hackers. Stuff that matters.
Re:Git is cheap by rkangel on Monday October 15, 2012 @06:50PM (#4657520)
He compares it to SVN, but makes a classic error. In SVN branches and commits are just as cheap as in git (albeit marginally slower to create usually). It's the merges that are expensive.

It's there that git wins, with it's better understanding of how content moves around, and the ability of the merge tool to see the history and identify the common ancestor.

Re:Git is cheap by _ikke_ on Tuesday October 16, 2012 @02:06AM (#4658622)
Branching in SVN is not cheap. It basically has to copy the entire directory structure into a new subdirectory (branches directory).

In git, it just creates one file with a 40 byte hex.

Re:Git is cheap by rkangel on Tuesday October 16, 2012 @08:33AM (#4659475)
Errr, no - while that's what you see in the directory tree, that's not how it's done internally. SVN has a data model where multiple paths in the repo tree can point to the same underlying file object, so a branch requires no file copies, just updating what the directory tree looks like. Even that is done in a very efficient way. It might not quite be 40 bytes, but it is negligibly small.

This technique is in fact extremely similar to how Git works.

Re:Git is cheap by andrewaylett on Tuesday October 16, 2012 @02:50PM (#4661266)
Server-side, that's cheap -- it doesn't actually copy any data. Client-side, it's also cheap: you `svn switch` to the new branch, which is identical to your old branch, so only minimal housekeeping on disk (just like git).
Re:Git is cheap by Peaker on Tuesday October 16, 2012 @03:39AM (#4658786)
Beyond branches being expensive, even commits in svn are expensive. They publish immediately, which requires proof-reading, more testing, before each commit. This means there's an incentive to wait with commits.

Even if you do commit to a branch, where publishing is less of a problem, you still might regret a typo in the commit, which cannot (easily) be retroactively fixed whereas in git you can fix your private/unpublished commits as much as you'd like with virtually no drawbacks.

Re:Git is cheap by rkangel on Tuesday October 16, 2012 @08:35AM (#4659488)
Good point - I suppose I hadn't considered it like that. I tend to happily commit to my feature branch on SVN and then make sure that the log message is good when I merge to trunk.

Incidentally you can edit previous log messages in SVN, it's just that most servers have it disabled, for traceability.

Re:Git is cheap by Peaker on Tuesday October 16, 2012 @02:11PM (#4661083)
In git you can edit the commit content as well retroactively.