Система управления версиями. Что это? Сравнение Git и SVN
Ситуация, в которой электронный документ за время своего существования претерпевает ряд изменений, достаточно типична. При этом часто бывает важно иметь не только последнюю версию, но и несколько предыдущих. В простейшем случае можно просто хранить несколько вариантов документа, нумеруя их соответствующим образом. Такой способ неэффективен (приходится хранить несколько практически идентичных копий), требует повышенного внимания и дисциплины и часто ведёт к ошибкам, поэтому были разработаны средства для автоматизации этой работы. В этой статье подробнее о каждой технологии.
Что такое система управления версиями?
Система управления версиями — программное обеспечение для облегчения работы с изменяющейся информацией. Система управления версиями позволяет хранить несколько версий одного и того же документа, при необходимости возвращаться к более ранним версиям, определять, кто и когда сделал то или иное изменение, и многое другое.
Такие системы наиболее широко используются при разработке программного обеспечения для хранения исходных кодов разрабатываемой программы. Однако они могут с успехом применяться и в других областях, в которых ведётся работа с большим количеством непрерывно изменяющихся электронных документов.
Git vs SVN
Git — распределённая система управления версиями. Проект был создан Линусом Торвальдсом для управления разработкой ядра Linux, первая версия выпущена 7 апреля 2005 года. Программа является свободной и выпущена под лицензией GNU GPL версии 2. По умолчанию используется TCP порт 9418.
Самая популярная система контроля версий на сегодняшний день.
- Легкая система . Мало весит, не ресурсозатратная.
- Скорость работы . Хорошо оптимизированная система.
- Архитектура . Работа Git’a отличается от привычных систем управления. Данные репозитория представлены слепками, из которых состоит весь проект.
- Репозитории . Из-за популярности Git существуют огромное количество репозиториев для проектов. Из бесплатных: GitHub и Azure.
- Инструменты для работы . Реализованы многофункциональные бесплатные инструменты, такие как SourceTree.
SVN — свободная централизованная система управления версиями, официально выпущенная в 2004 году компанией CollabNet. С 2010 года Subversion является одним из проектов Apache Software Foundation и официально называется Apache Subversion.
Цель проекта в начале разработки — заменить распространённую на тот момент систему Concurrent Versions System (CVS), которая на сегодняшний день считается морально устаревшей. Subversion реализует все основные функции CVS и свободна от ряда недостатков последней.
- Форматы хранилища. Можно выбрать тип хранения репозитория (БД, набор файлов).
- Библиотеки языков. Строенные библиотеки для языков, которые включают функционал по работе с системой.
- Инструменты для работы. Как и с Git существуют приложения для работы с SVN. Пример: TortoiseSVN.
SVN был заменой CVS, который успешно с этим справился, однако со временем Git набрал популярность за счет архитектуры и удобной работы с системой.
Проектов c системой SVN становится всё меньше. За счет популярности Git получает всё больше фишек, инструментов и хостингов репозиториев. Мой личный выбор Git.
how to convert svn repository to git on Windows
We have remote svn repository and we want it to convert to git. Could you please tell me how is it possible to do it on Windows? Thank.
4 Answers 4
Install application on Windows:
Find out the svn repository URL and copy it
Something like this:
Invoke TortoiseGit Clone dialog
Right click on destination folder, e.g. D:\SVN\ToGit , and Click Git Clone.
Check the From SVN repository checkbox
If you copied the URL first, then invoke the clone dialog, TortoiseGit will get the copied URL from clipboard and paste it into the URL text field for you. So, you don’t paste it by yourself. Just have look at it to see if it’s correct.
And if you right click on destination folder, TortoiseGit also fill the Directory text field for you. Also, take a look to see if it’s what you want.
So, just check the From SVN repository checkbox.
And if the svn repository has the standard layout, say trunk, tags, branches, you don’t need to do anything further.
Click the OK button to go
Then, starting to clone a svn repository to git repository.
Something like this:
As you can see, TortoiseGit just properly uses Git for Windows command git svn clone to clone it.
So, basically, you can go Git Bash/CMD and re-use that command line, and also get the same result.
NOTE: If you can see the r1 , r2 , r3 . you can stop the cloning anytime, and resume it later by using the same command line.
Clone a local svn repository
With TortoiseGit 2.4.4+
Just copy the svn local path into URL of Clone dialog. See: 
Again, Check the From SVN repository checkbox
TortoiseGit 2.4.4+ will use file:/// protocol to clone a local svn repository.
After you get a git repository, you can commit there. And push the commit back to origin svn repository by using TortoiseGit -> SVN DCommit. , something like svn commit .
As you can see, the command is git svn dcommit .
And if the origin svn repository has some new commit(s) need to update, you can use TortoiseGit -> SVN Rebase to fetch the svn commit and then merge/rebase on the latest commit. Something like svn update .
It uses git svn fetch then uses git rebase to merge/rebase the fetched changes.
For command line, you could just use git svn rebase .
Read Pro Git v2 — Chapter 9 for more information and examples.
git-svn on Windows. Where to get binaries?
I want to use git as a local repository against a remote SVN repository. I installed version 1.6.0.2 from http://code.google.com/p/msysgit/downloads/list.
According to the documentation synchronization is done via the command
or a separate command wrapper called
Neither of them is available in my installation and I could not find a separate download for Windows binaries.
I’m currenty using the MSYS build. Must I switch to cygwin?
5 Answers 5
This earlier version has working git-svn. I thought that git-svn in the current version that you installed was fixed, but maybe not. Git-svn definitely did not work in the windows version of Git 1.5.6.1.
git-svn is installed in the latest version of msysgit. However, there’s a slight caveat: while git-svn shows up in C:\Program Files\git\libexec as «git-svn», svn is actually called as an argument to the git executable, thus:
Install cygwin and select the git-svn package under the Devel category.
The git svn command is written in Perl and requires the Subversion Perl libraries. The existence of the svn command line command is insufficient for git-svn .
I haven’t used git svn on Windows (only on Unix and Mac OS X), so I can’t really provide more detail, but hopefully this should point you in the right direction.
I don’t know git, but I know that for Mercurial, for example, you have to have SVN installed to convert from SVN to Mercurial (and back). Perhaps it is the same for git?
SVN is quite big by itself, so perhaps concurrent systems won’t want to distribute it with their software, bloating the download.
I used the command line SVN client from Slik SVN, not too big and installing cleanly.
Of course, wait for more informed answer, or search the Web for confirmation of my information. 🙂 Although it doesn’t hurt to have an SVN client, since lot of projects use it.









