32

I am musing about building a big system on top of git for various reasons but mainly convenience.

But as part of the implementation I would end up making millions of branches and branching and merging between them. Can git actually scale this way? I always hear "Branches are free" but I have to wonder if this is really true x1,000,000? Can git actually create a theoretical unlimited number of branches?

user1778366
  • 323
  • 1
  • 3
  • 5
  • 2
    Wow...what kind of system requires a million branches?? It's hard enough to write that many lines of code... :o – nneonneo Oct 26 '12 at 22:54
  • 4
    Basically a user-facing system that actually uses branch creation, merging, etc. in the back end. Halfway through development spec I realized what I was making was a perfect metaphor for git. If I could use git, would be amazing. – user1778366 Oct 26 '12 at 23:03

2 Answers2

24

Yes, branches are free. Branching and merging is very easy.

The scalability issues mentioned before comes only when synchronizing a vast amount of branches through the network (git fetch, git pull, git push). Locally you shouldn't have any problem.

FelipeC
  • 9,123
  • 4
  • 44
  • 38
5

There was a thread about scalability problems in this area on the git mailing list last year, as I recall there were some improvements made but I don't recall off hand what the performance was like with the changes that got incorporated into newer versions as a result.

Here's a link to an archive of that thread via the wayback machine:

https://web.archive.org/web/20141105052551/http://git.661346.n2.nabble.com/Git-is-not-scalable-with-too-many-refs-td6456443.html

Or that same thread in a more modern archive (this URL should be somewhat useful even if it stops working, since it contains the message ID): https://public-inbox.org/git/BANLkTimnCqaEBVreMhnbRBV3r-r1ZzkFcg@mail.gmail.com/

qqx
  • 18,947
  • 4
  • 64
  • 68