Should I use SVN or Git?
I am starting a new distributed project. Should I use SVN or Git, and why?
21 Solutions collect form web for “Should I use SVN or Git?”
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.
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.
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).
2 key advantages of SVN that are rarely cited:
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.
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.
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?
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 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.
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:
- I can work distributed on several
machines, commiting and pulling from
and to them
- I have a central
backup/publicsvn repository for others to check out
- And they are free to use Git for their own
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]
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.
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.
I would opt for SVN since it is more widely spread and better known.
I guess, Git would be better for Linux user.
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.
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.
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.
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?
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.
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…
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.
There is an interesting Video on YouTube about this. Its from Linus Torwalds himself: Goolge Tech Talk: Linus Torvalds on git
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.
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.