326

I am starting a new distributed project. Should I use SVN or Git, and why?

11

21 Answers 21

256

SVN is one repo and lots of clients. Git is a repo with lots of client repos, each with a user. It's decentralised to a point where people can track their own edits locally without having to push things to an external server.

SVN is designed to be more central where Git is based on each user having their own Git repo and those repos push changes back up into a central one. For that reason, Git gives individuals better local version control.

Meanwhile you have the choice between TortoiseGit, GitExtensions (and if you host your "central" git-repository on github, their own client – GitHub for Windows).

If you're looking on getting out of SVN, you might want to evaluate Bazaar for a bit. It's one of the next generation of version control systems that have this distributed element. It isn't POSIX dependant like git so there are native Windows builds and it has some powerful open source brands backing it.

But you might not even need these sorts of features yet. Have a look at the features, advantages and disadvantages of the distributed VCSes. If you need more than SVN offers, consider one. If you don't, you might want to stick with SVN's (currently) superior desktop integration.

14
  • 25
    Might also have a look at Hg (Mercury)
    – Joel
    Mar 30, 2010 at 22:24
  • 24
    Things have gotten much better since October 2008. You can install TortoiseGit, grab the latest portable version of MSysGit, and tell TortoiseGit where to find it. I just moved my big svn repo over to git today because svn's poor renaming support finally made me mad enough. Sep 24, 2010 at 19:37
  • 4
    Moving on 2 years we now have some good windows tools. Currently I'm using netbeans with MSysGit. I've also had good luck with TortoiseGit. I think it's good enough to be used in production. Considering how hard it is to manage simple conflicts in subversion git is a huge improvement.
    – Benbob
    Oct 27, 2010 at 1:19
  • 24
    We use Git on Windows heavily and have for a long time now. Git is absolutely fantastic on Windows. Feb 6, 2011 at 5:18
  • 13
    @Oli Would be good to update your answer (esp about Windows git client) based on the comments here and your experience. The current answer seems biased now that 2-3 years have passed since it was written.
    – amit kumar
    May 16, 2011 at 3:27
116

I have never understand this concept of "git not being good on Windows"; I develop exclusively under Windows and I have never had any problems with git.

I would definitely recommend git over subversion; its simply so much more versatile and allows "offline development" in a way subversion never really could. Its available on almost every platform imaginable and has more features than you'll probably ever use.

6
  • 9
    I, on the other hand, had quite some problems with git on windows, it did really strange things to my repo. And I was using the most recent version in cygwin (it was something like a month ago). Jun 13, 2009 at 8:32
  • 7
    @Roman: well, the Cygwin port is hardly the same thing as the native win32 port. I expect the Cygwin port is much less well-tested...
    – SamB
    Mar 30, 2010 at 22:32
  • 50
    "more features than you'll probably ever use" is a red flag in my book
    – B T
    Jun 5, 2011 at 1:36
  • 27
    @ B T "red flag" I disagree. I often find myself wishing there was a way to do something and after a little bit of searching I find out there are a few commands I didn't know about that do just that. I use GIT on my windows machine as well and have yet to have any major problems.
    – testing123
    Aug 4, 2011 at 16:17
  • @testing123 but then they are not features "you'll probably [n]ever use" because you actually ended up using them. Jun 6, 2012 at 6:29
76

Here is a copy of an answer I made of some duplicate question since then deleted about Git vs. SVN (September 2009).

Better? Aside from the usual link WhyGitIsBetterThanX, they are different:

one is a Central VCS based on cheap copy for branches and tags the other (Git) is a distributed VCS based on a graph of revisions. See also Core concepts of VCS.


That first part generated some mis-informed comments pretending that the fundamental purpose of the two programs (SVN and Git) is the same, but that they have been implemented quite differently.
To clarify the fundamental difference between SVN and Git, let me rephrase:

  • SVN is the third implementation of a revision control: RCS, then CVS and finally SVN manage directories of versioned data. SVN offers VCS features (labeling and merging), but its tag is just a directory copy (like a branch, except you are not "supposed" to touch anything in a tag directory), and its merge is still complicated, currently based on meta-data added to remember what has already been merged.

  • Git is a file content management (a tool made to merge files), evolved into a true Version Control System, based on a DAG (Directed Acyclic Graph) of commits, where branches are part of the history of datas (and not a data itself), and where tags are a true meta-data.

To say they are not "fundamentally" different because you can achieve the same thing, resolve the same problem, is... plain false on so many levels.

  • if you have many complex merges, doing them with SVN will be longer and more error prone. if you have to create many branches, you will need to manage them and merge them, again much more easily with Git than with SVN, especially if a high number of files are involved (the speed then becomes important)
  • if you have partial merges for a work in progress, you will take advantage of the Git staging area (index) to commit only what you need, stash the rest, and move on on another branch.
  • if you need offline development... well with Git you are always "online", with your own local repository, whatever the workflow you want to follow with other repositories.

Still the comments on that old (deleted) answer insisted:

VonC: You are confusing fundamental difference in implementation (the differences are very fundamental, we both clearly agree on this) with difference in purpose.
They are both tools used for the same purpose: this is why many teams who've formerly used SVN have quite successfully been able to dump it in favor of Git.
If they didn't solve the same problem, this substitutability wouldn't exist.

, to which I replied:

"substitutability"... interesting term (used in computer programming).
Off course, Git is hardly a subtype of SVN.

You may achieve the same technical features (tag, branch, merge) with both, but Git does not get in your way and allow you to focus on the content of the files, without thinking about the tool itself.

You certainly cannot (always) just replace SVN by Git "without altering any of the desirable properties of that program (correctness, task performed, ...)" (which is a reference to the aforementioned substitutability definition):

  • One is an extended revision tool, the other a true version control system.
  • One is suited small to medium monolithic project with simple merge workflow and (not too much) parallel versions. SVN is enough for that purpose, and you may not need all the Git features.
  • The other allows for medium to large projects based on multiple components (one repo per component), with large number of files to merges between multiple branches in a complex merge workflow, parallel versions in branches, retrofit merges, and so on. You could do it with SVN, but you are much better off with Git.
    SVN simply can not manage any project of any size with any merge workflow. Git can.

Again, their nature is fundamentally different (which then leads to different implementation but that is not the point).
One see revision control as directories and files, the other only see the content of the file (so much so that empty directories won't even register in Git!).

The general end-goal might be the same, but you cannot use them in the same way, nor can you solve the same class of problem (in scope or complexity).

1
  • 10
    I don't disagree with you that git and svn are fundamentally different, but I do disagree on many of your points. svn may have been written to replace cvs, but they're in no way related otherwise, while cvs started as scripts on top of RCS so there's a direct relation. Still, the person you are quoting is entirely right, they both fundamentally manage revisions of files, the implementation and the process in which that happens (or how it does it) are implementation details. It's like the difference between CRC and SHA1, fundamentally very different but they do the same thing. Jul 4, 2013 at 1:58
38

2 key advantages of SVN that are rarely cited:

  1. Large file support. In addition to code, I use SVN to manage my home directory. SVN is the only VCS (distributed or not) that doesn't choke on my TrueCrypt files (please correct me if there's another VCS that handles 500MB+ files effectively). This is because diff comparisons are streamed (this is a very essential point). Rsync is unacceptable because it's not 2-way.

  2. Partial repository (subdir) checkout/checkin. Mercurial and bzr don't support this, and git's support is limited. This is bad in a team environment, but invaluable if I want to check something out on another computer from my home dir.

Just my experiences.

7
  • 7
    "please correct me if there's another VCS that handles 500MB+ files effectively" - Perforce of course! Jun 22, 2010 at 23:49
  • 8
    Perforce = non free. Also, Perforce is not available for all platforms.
    – WhyNotHugo
    Sep 17, 2010 at 14:48
  • 4
    Why not put the SVN repo INSIDE the truecrypt containers? You could also tunnel that though ssh, and configure the server to store that particular repo inside another truecrypt file. This has the added advantage that you can make partial checkouts of that repo.
    – WhyNotHugo
    Sep 17, 2010 at 14:49
  • 1
    @Hugo as far as I know, Perforce client is available for Windows, Unix, Linux variants, Mac, Amiga, BeOS, Cygwin, HPUX, IBM AS/400, OS/2, DEC VMS and Novell File Server. Is there some relevant platform missing from the list?
    – eis
    Feb 14, 2012 at 10:20
  • 1
    Yes, OpenBSD (and I knew this from experience, didn't need to google this). I guess it won't work on maemo either, though I might be wrong (and yes, I use git on maemo).
    – WhyNotHugo
    Feb 29, 2012 at 4:57
25

After doing more research, and reviewing this link: https://git.wiki.kernel.org/articles/g/i/t/GitSvnComparison_cb82.html

(Some extracts below):

  • It's incredibly fast. No other SCM that I have used has been able to keep up with it, and I've used a lot, including Subversion, Perforce, darcs, BitKeeper, ClearCase and CVS.
  • It's fully distributed. The repository owner can't dictate how I work. I can create branches and commit changes while disconnected on my laptop, then later synchronize that with any number of other repositories.
  • Synchronization can occur over many media. An SSH channel, over HTTP via WebDAV, by FTP, or by sending emails holding patches to be applied by the recipient of the message. A central repository isn't necessary, but can be used.
  • Branches are even cheaper than they are in Subversion. Creating a branch is as simple as writing a 41 byte file to disk. Deleting a branch is as simple as deleting that file.
  • Unlike Subversion branches carry along their complete history. without having to perform a strange copy and walk through the copy. When using Subversion I always found it awkward to look at the history of a file on branch that occurred before the branch was created. from #git: spearce: I don't understand one thing about SVN in the page. I made a branch i SVN and browsing the history showed the whole history a file in the branch
  • Branch merging is simpler and more automatic in Git. In Subversion you need to remember what was the last revision you merged from so you can generate the correct merge command. Git does this automatically, and always does it right. Which means there's less chance of making a mistake when merging two branches together.
  • Branch merges are recorded as part of the proper history of the repository. If I merge two branches together, or if I merge a branch back into the trunk it came from, that merge operation is recorded as part of the repostory history as having been performed by me, and when. It's hard to dispute who performed the merge when it's right there in the log.
  • Creating a repository is a trivial operation: mkdir foo; cd foo; git init That's it. Which means I create a Git repository for everything these days. I tend to use one repository per class. Most of those repositories are under 1 MB in disk as they only store lecture notes, homework assignments, and my LaTeX answers.
  • The repository's internal file formats are incredible simple. This means repair is very easy to do, but even better because it's so simple its very hard to get corrupted. I don't think anyone has ever had a Git repository get corrupted. I've seen Subversion with fsfs corrupt itself. And I've seen Berkley DB corrupt itself too many times to trust my code to the bdb backend of Subversion.
  • Git's file format is very good at compressing data, despite it's a very simple format. The Mozilla project's CVS repository is about 3 GB; it's about 12 GB in Subversion's fsfs format. In Git it's around 300 MB.

After reading all this, I'm convinced that Git is the way to go (although a little bit of learning curve exists). I have used Git and SVN on Windows platforms as well.

I'd love to hear what others have to say after reading the above?

6
  • 15
    Git is incredibly fast on some operations, mainly because the operation only affects your local repository. A Git checkin, for example, should not justly be compared to a SVN checkin, because a SVN checkin is also a push of the change to a staging repository for the rest of your team. That requires a network hit, and comparing Git's no network commit to a network transfer smacks of inappropriate comparison. If you commit, and then lose the hard drive, with Git you lost your change. That's fine if that is what you grow to expect, but it's not expected in non-distributed SCMs.
    – Edwin Buck
    Mar 29, 2012 at 21:59
  • 1
    @EdwinBuck Not taking what Waqar did into account, in tests even with network time taken into account git tends to be faster: git-scm.com/about/small-and-fast
    – Sqeaky
    Jun 7, 2013 at 18:33
  • Your "Creating a repository is a trivial operation" point is extremly important, especially on Windows: compared to SVN, it's far easier to quickly simulate a bunch of interconnected distributed repos, all conected to a central (--bare) repo with Git than it is to do the analogous with SVN (install Windows SVN server application, etc). Also (bizarely) I find Git to be more consistent across OSs: the command line is very well designed and thus sufficient most of the time (and virtually identical between OSs) vs various SVN native client/server apps... Oct 10, 2014 at 11:35
  • 1
    The wiki article you refer to is full of mistakes. Therefore, your answer is wrong. Downvoted. There is a talk page on the wiki that refers to svnvsgit.com telling why the comparison is wrong.
    – bahrep
    Dec 27, 2015 at 13:56
  • Incredibly fast? I've moved the ciforth project from a local cvs to github. This is a simple project but has one large main source file of 10,000 lines. If I try to use blame on this file github falls in a time out. Mostly if one is not content with saying fast, and insist in using such a qualifier it is not a balanced opinion, making me suspicious about all you say. Groetjes Albert Jun 29, 2017 at 10:40
12

I would set up a Subversion repository. By doing it this way, individual developers can choose whether to use Subversion clients or Git clients (with git-svn). Using git-svn doesn't give you all the benefits of a full Git solution, but it does give individual developers a great deal of control over their own workflow.

I believe it will be a relatively short time before Git works just as well on Windows as it does on Unix and Mac OS X (since you asked).

Subversion has excellent tools for Windows, such as TortoiseSVN for Explorer integration and AnkhSVN for Visual Studio integration.

11

The funny thing is: I host projects in Subversion Repos, but access them via the Git Clone command.

Please read Develop with Git on a Google Code Project

Although Google Code natively speaks Subversion, you can easily use Git during development. Searching for "git svn" suggests this practice is widespread, and we too encourage you to experiment with it.

Using Git on a Svn Repository gives me benefits:

  1. I can work distributed on several machines, commiting and pulling from and to them
  2. I have a central backup/public svn repository for others to check out
  3. And they are free to use Git for their own
1
  • 4
    Just a note: As of July 2011, Google Code supports Git natively. Jan 1, 2012 at 9:38
9

Not really answering your question but if you want the benefits of Distributed Revision Control - it sounds like you do - and you're using Windows I think you'd be better off using Mercurial rather that Git as Mercurial has much better Windows support. Mercurial does have a Mac port too.

9

If your team is already familiar with version and source control softwares like cvs or svn, then, for a simple and small project (such as you claim it is), I would recommend you stick to SVN. I am really comfortable with svn, but for the current e-commerce project I am doing on django, I decided to work on git (I am using git in svn-mode, that is, with a centralised repo that I push to and pull from in order to collaborate with at least one other developer). The other developer is comfortable with SVN, and while others' experiences may differ, both of us are having a really bad time embracing git for this small project. (We are both hardcore Linux users, if it matters at all.)

Your mileage may vary, of course.

8

The main point is, that Git is a distributed VCS and Subversion a centralized one. Distributed VCSs are a little bit more difficult to understand, but have many advantages. If you don't need this advantages, Subversion may the better choice.

Another question is tool-support. Which VCS is better supported by the tools you plan to use?

EDIT: Three years ago I answered this way:

And Git works on Windows at the moment only via Cygwin or MSYS. Subversion supported Windows from the beginning. As the git-solutions for windows may work for you, there may be problems, as the most developers of Git work with Linux and didn't have portability in the mind from the beginning. At the moment I would prefer Subversion for development under Windows. In a few years this may be irrelevant.

Now the world has changed a little bit. Git has a good implementation on windows now. Although I tested not thouroughly on windows (as I no longer use this system), I'm quite confident, that all the major VCS (SVN, Git, Mercurial, Bazaar) have proper Windows-implementation now. This advantage for SVN is gone. The other points (Centralized vs. Distributed and the check for tool support) stay valid.

10
  • I am optimistic that the horizon of irrelevancy will be much shorter than a few years. Oct 2, 2008 at 9:57
  • Yes, possibly it will only one year. Git has a dynamic development-community. But subversion has too. In a year or two you will have to look at both again to answer this question.
    – Mnementh
    Oct 2, 2008 at 11:28
  • 1
    It's now a year or two later. How's it lookin? :) Nov 9, 2011 at 11:40
  • 3
    Git lacks an extension of the distributed SCM model to the other phases of the software development pipeline. We don't have a good model for distributed release build systems, distributed automated testing, quality control, release control, etc. We are just getting some experimental support for distributed backup, and that's after decades of research. As such Git offers more to the developer and less to the software development process. All Git implementations eventually bless one repo to be the central one, which simplifies the most interesting Git abilities into facsimiles of SVN ones.
    – Edwin Buck
    Mar 29, 2012 at 22:06
  • 1
    @hibbelig Git doesn't have a central repository, every repository is effectively (due to its distributed design) equal. This means that you either rework your production pipeline to possibly handle all repositories equally, or artificially bless one repository to be of "artificially elevated" status (aka the central repository). If you do the former, nobody knows much about building parallel pipelines where a release could come from any developer's desk, if you do the latter, the promise of distributed processing is cheated by centralized convention.
    – Edwin Buck
    Nov 14, 2012 at 22:14
7

Definitely svn, since Windows is—at best—a second-class citizen in the world of git (see http://en.wikipedia.org/wiki/Git_(software)#Portability for more details).

UPDATE: Sorry for the broken link, but I've given up trying to get SO to work with URIs that contain parentheses. [link fixed now. -ed]

7
  • 1
    FYI: enclose the URL in angle brackets, or replace parentheses with %28 and %29.
    – PhiLho
    Oct 2, 2008 at 10:35
  • 1
    Will the URL-encoding work for the []() syntax?
    – Hank Gay
    Oct 2, 2008 at 11:44
  • 16
    This is incorrect FUD. Git is fantastic on Windows. And SVN is pretty bad everywhere. Feb 6, 2011 at 5:21
  • 6
    For all those downvoting me, please go back and look at the developer comments from circa 2008: it's pretty clear that Linus and the gang did not care about supporting Windows. That's fine: I don't really want to do it either, and my software isn't nearly as complex as VCS that expects POSIXish behavior from the filesystem. It seems unfair, though, to characterize my statement as FUD if you look at the context.
    – Hank Gay
    Mar 17, 2011 at 12:25
  • 2
    Maybe in 2008 git was bad on Windows, but I've been using msysgit since 2009 and it works flawlessly. That includes gitk, the offline desktop equivalent of GitHub. Jul 1, 2011 at 7:49
6

I would opt for SVN since it is more widely spread and better known.

I guess, Git would be better for Linux user.

2
4

Git is not natively supported under Windows, just yet. It is optimized for Posix systems. However running Cygwin or MinGW lets you run Git successful.

Nowadays I prefer Git over SVN, but it takes a while to get over the threshold if you come from CVS, SVN land.

1
  • 8
    Define 'natively'. msysgit works just fine Oct 6, 2008 at 7:26
4

I would probably choose Git because I feel it's much more powerful than SVN. There are cheap Code Hosting services available which work just great for me - you don't have to do backups or any maintenance work - GitHub is the most obvious candidate.

That said, I don't know anything regarding the integration of Visual Studio and the different SCM systems. I imagine the integration with SVN to notably better.

4

I have used SVN for a long time, but whenever I used Git, I felt that Git is much powerful, lightweight, and although a little bit of learning curve involved but is better than SVN.

What I have noted is that each SVN project, as it grows, becomes a very big size project unless it is exported. Where as, GIT project (along with Git data) is very light weight in size.

In SVN, I've dealt with developers from novice to experts, and the novices and intermediates seem to introduce File conflicts if they copy one folder from another SVN project in order to re-use it. Whereas, I think in Git, you just copy the folder and it works, because Git doesn't introduce .git folders in all its subfolders (as SVN does).

After dealing alot with SVN since long time, I'm finally thinking to move my developers and me to Git, since it is easy to collaborate and merge work, as well as one great advantage is that a local copy's changes can be committed as much desired, and then finally pushed to the branch on server in one go, unlike SVN (where we have to commit the changes from time to time in the repository on server).

Anyone who can help me decide if I should really go with Git?

2
  • I wouldn't call any developer who copied a SVN controlled folder over into another project to re-use it and didn't expect obvious troubles 'intermediate'. I'd call them novices. Yes, you are right, it is due to the .svn sub-folder that tells SVN to what repository the files belong. If the user deleted this .svn sub-folder, then they could import the folder into the new SVN project. I'm still with SVN myself, but my needs are few. GIT is great for larger projects.
    – dyasta
    Jan 27, 2012 at 18:44
  • 3
    The latest svn clients don't need a .svn folder in each sub-directory. That "fixes" the copying error before it happens.
    – Edwin Buck
    Mar 29, 2012 at 22:08
4

It comes down to this:

Will your development be linear? If so, you should stick with Subversion.

If on the other hand, your development will not be linear, which means that you will need to create branching for different changes, and then merging such changes back to the main development line (known to Git as the master branch) then Git will do MUCH more for you.

3

have you tried Bzr?

It's pretty good, connonical (the people who make Ubuntu) made it because they didn't like anything else on the market...

5
  • The windows support really does need a bit of work here, though. Not so much that I haven't been quite happily using it for all of my recent programming under Windows (of which I've been doing a fair bit), or anything, but still...
    – SamB
    Mar 30, 2010 at 22:41
  • It almost 100% of the time with OS, that people "made it [any software] because the didn't like anything else in the market".
    – WhyNotHugo
    Sep 17, 2010 at 15:42
  • @Hugo With open source, if they liked something else on the market, they would contribute to it instead of making something new.
    – yingted
    Aug 13, 2011 at 19:14
  • This is not an answer to the question at all Jun 29, 2017 at 11:00
  • @AlbertvanderHorst No it's not, the question was answered in the wild west days of SO when no one knew any better, and offered an alternative. Arguable in my haste it looks like I've also misspelled Canonical's name. Shame on me! Jul 12, 2017 at 15:13
3

May I expand on the question and ask if Git work well on MacOS?

Reply to Comments: Thanks for the news, I'd been looking forward to trying it out. I'll install it at home on my Mac.

5
  • 1
    Yes, it works beautifully. I installed it through MacPorts and use it daily. Oct 2, 2008 at 9:57
  • It does. It's great on any POSIX-based system (Unix, Linux, Solaris, BSD, etc). It's really just Windows where the problem lies.
    – Oli
    Oct 2, 2008 at 9:58
  • and the git-gui and gitk probably work the same under OS-X as under Linux and Windows. Contrary to tortoiseSVN, which AFAIK is windows-only? Oct 2, 2008 at 10:28
  • @David Schmitt: well, tortoisesvn.tigris.org calls it a "Windows Shell Extension for Subversion", so I'd assume so, yes ;-).
    – SamB
    Mar 30, 2010 at 22:36
  • @Robert: how was your experience with git on OS X? Apr 1, 2010 at 6:21
3

There is an interesting Video on YouTube about this. Its from Linus Torwalds himself: Goolge Tech Talk: Linus Torvalds on git

2

SVN seems like a good choice under Windows, as pointed by other people.

If some of your developper wants to try GIT, it may always use GIT-SVN where the SVN repository is recreated in a GIT repository. Then he should be able to work locally with GIT and then use SVN to publish its changes to the main repository.

1

You have to go with a DVCS, it is like a quantum leap in source management. Personally I use Monotone and its sped up development time no end. We are using it for Windows, Linux and Mac and it has been very stable. I even have buildbot doing nightly builds of the project on each of the platforms.

DVCS while being distributed usually means you will create a central server just for people to push changes to and from.

Not the answer you're looking for? Browse other questions tagged or ask your own question.