Chuyển tới nội dung
Home » What Is Git Svn | Handling Of Svn Branches

What Is Git Svn | Handling Of Svn Branches

Git vs SVN Differences

What Is Subversion (SVN)?

Subversion software, also called SVN, is an open source version control system. Subversion (SVN) allows teams to look at previous file versions and track their changes over time.

Subversion was initially released in 2000 by CollabNet. It’s now licensed under Apache.

Subversion software is an open-source, community driven project which has seen minor and infrequent updates over the years. Given the nature of the SVN project, there is no set timetable for their next release.

Back to top



This sets GIT_SVN_ID (instead of using the environment). This allows the user to override the default refname to fetch from when tracking a single URL. The log and dcommit commands no longer require this switch as an argument.


Specify the [svn-remote ”

“] section to use, this allows SVN multiple repositories to be tracked. Default: “svn”


This option is only relevant if we are tracking branches (using one of the repository layout options –trunk, –tags, –branches, –stdlayout). For each tracked branch, try to find out where its revision was copied from, and set a suitable parent in the first Git commit for the branch. This is especially helpful when we’re tracking a directory that has been moved around within the repository. If this feature is disabled, the branches created by git svn will all be linear and not share any history, meaning that there will be no information on where branches were branched off or merged. However, following long/convoluted histories can take a long time, so disabling this feature may speed up the cloning process. This feature is enabled by default, use –no-follow-parent to disable it.

config key: svn.followparent

Git vs SVN Differences
Git vs SVN Differences

Relocating an SVN repository URL

Relocating the SVN repository URL is not supported by git-svn. The reason for this is that git-svn stores the SVN repository URL in each commit and relies on this information. If you wanted to change the SVN repository URL you would have to rewrite the entire commit history to change the URL in each commit. You would also have to completely rebuild the SVN metadata. If you do not have any pending commits, just re-cloning the SVN repository is probably much more comfortable.

Another option is to add a second SVN remote repository with the new URL and then migrate your changes from the old branches to the new ones by stashing or cherry-picking single changes.

If you have not tried Tower yet, you can download the latest version and give it a try.

SVN vs Git: Which Version Control System Should You Use?

Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.

Version Control Systems (VCS), like Git and SVN, track and manage code changes and provide an efficient way to collaborate on software development projects. A VCS is especially useful as a software development project grows in size and complexity, but even the simplest projects can benefit from tracking code changes with a VCS.

Git and SVN are two of the most popular open source VCS solutions. Git has recently skyrocketed in popularity due to its use by developers collaborating on open-source projects. SVN, on the other hand, has been more commonly used in enterprise software development projects.

This guide discusses the features and pros and cons of Git and SVN to help you choose the best VCS for your software development project.


If git svn is configured to fetch branches (and –follow-branches is in effect), it sometimes creates multiple Git branches for one SVN branch, where the additional branches have names of the form branchname@nnn (with nnn an SVN revision number). These additional branches are created if git svn cannot find a parent commit for the first commit in an SVN branch, to connect the branch to the history of the other branches.

Normally, the first commit in an SVN branch consists
of a copy operation. git svn will read this commit to get the SVN
revision the branch was created from. It will then try to find the
Git commit that corresponds to this SVN revision, and use that as the
parent of the branch. However, it is possible that there is no suitable
Git commit to serve as parent. This will happen, among other reasons,
if the SVN branch is a copy of a revision that was not fetched by git
svn (e.g. because it is an old revision that was skipped with


), or if in SVN a directory was copied that is not tracked
by git svn (such as a branch that is not tracked at all, or a
subdirectory of a tracked branch). In these cases, git svn will still
create a Git branch, but instead of using an existing Git commit as the
parent of the branch, it will read the SVN history of the directory the
branch was copied from and create appropriate Git commits. This is
indicated by the message “Initializing parent:


Additionally, it will create a special branch named


, where

is the SVN revision number the branch was copied from. This branch will point to the newly created parent commit of the branch. If in SVN the branch was deleted and later recreated from a different version, there will be multiple such branches with an @.

Note that this may mean that multiple Git commits are created for a single SVN revision.

An example: in an SVN repository with a standard trunk/tags/branches layout, a directory trunk/sub is created in r.100. In r.200, trunk/sub is branched by copying it to branches/. git svn clone -s will then create a branch sub. It will also create new Git commits for r.100 through r.199 and use these as the history of branch sub. Thus there will be two Git commits for each revision from r.100 to r.199 (one containing trunk/, one containing trunk/sub/). Finally, it will create a branch sub@200 pointing to the new parent commit of branch sub (i.e. the commit for r.200 and trunk/sub/).

Connect; 2017 Moving from Subversion to Git
Connect; 2017 Moving from Subversion to Git

Pushing local changes to SVN

git svn dcommit --rmdir

will create a SVN commit for each of your local git commits. As with SVN, your local git history must be in sync with the latest changes in the SVN repository, so if the command fails, try performing a

git svn rebase


Side note

Your local git commits will be rewritten when using the command

git svn dcommit

. This command will add a text to the git commit’s message referencing the SVN revision created in the SVN server, which is VERY useful. However, adding a new text requires modifying an existing commit’s message which can’t actually be done: git commits are inmutable. The solution is create a new commit with the same contents and the new message, but it is technically a new commit anyway (i.e. the git commit’s SHA1 will change)


“Subversion is a system that is far less sophisticated than Git” so you can’t use all the full power of git without messing up the history in the Subversion server. Fortunately the rules are very simple:

Keep the history linear

That’s it.

This means you can make all kind of crazy local operations: branches, removing/reordering/squashing commits, move the history around, delete commits, etc anything but merges.

Local merges

Do not merge your local branches, if you need to reintegrate the history of local branches use

git rebase


When you perform a merge, a merge commit is created. The particular thing about merge commits is that they have two parents, and that makes the history non-linear. Non-linear history will confuse SVN in the case you “push” a merge commit to the repository.

However do not worry: you won’t break anything if you “push” a git merge commit to SVN.

If you do so, when the git merge commit is sent to the svn server it will contain all the changes of all commits for that merge, so you will lose the history of those commits, but not the changes in your code.

Handling empty folders properly

git does not recognice the concept of folders, it just works with files and their filepaths. This means git does not track empty folders. SVN, however, does. Using git svn means that, by default, any change you do involving empty folders with git will not be propagated to SVN.Fortunately the


flag corrects this issue, and makes git remove an empty folder in SVN if you remove the last file inside of it. Unfortunatelly it does not removes existing empty folders, you need to do it manually

To avoid needing to issue the flag each time you do a dcommit, or to play it safe if you are using a git GUI tool (like SourceTree) you need to set this behaviour as default, just issue the command:

git config --global svn.rmdir true

This changes your .gitconfig file and adds these lines:

[svn] rmdir = true

Be careful if you issue the command

git clean -d

. That will remove all untracked files including folders that should be kept empty for SVN.
If you need to generate againg the empty folders tracked by SVN use the command

git svn mkdirs


In practices this means that if you want to cleanup your workspace from untracked files and folders you should always use both commands:

git clean -fd && git svn mkdirs

Cloning really big SVN repositories

If you SVN repo history is really really big this operation could take hours, as git svn needs to rebuild the complete history of the SVN repo. Fortunately you only need to clone the SVN repo once; as with any other git repository you can just copy the repo folder to other collaborators. Copying the folder to multiple computers will be quicker that just cloning big SVN repos from scratch.

About commits and SHA1

As git commits created for git svn are local, the SHA1 ids for git commits is only work locally. This means that you can’t use a SHA1 to reference a commit for another person because the same commit will have a diferent SHA1 in each machine. You need to rely in svn revision number. The number is appended to the commit message when you push to the SVN server

You can use the SHA1 for local operations though (show/diff an specific commit, cherry-picks and resets, etc)


Supported Subversion features on GitHub


The first thing you’ll want to do is a Subversion checkout. Since Git clones keep the working directory (where you edit files) separate from the repository data, there is only one branch in the working directory at a time.

Subversion checkouts are different: they mix the repository data in the working directories, so there is a working directory for each branch and tag you’ve checked out. For repositories with many branches and tags, checking out everything can be a bandwidth burden, so you should start with a partial checkout.

  1. On your GitHub Enterprise Server instance, navigate to the main page of the repository.

  2. Above the list of files, click Code.

  3. Copy the URL for the repository.

    • To clone the repository using HTTPS, under “HTTPS”, click .

    • To clone the repository using an SSH key, including a certificate issued by your organization’s SSH certificate authority, click SSH, then click .

    • To clone a repository using GitHub CLI, click GitHub CLI, then click .

  4. Make an empty checkout of the repository:

    svn co --depth empty Checked out revision 1. cd REPO

  5. Get the


    branch. The Subversion bridge maps trunk to the Git HEAD branch.

    svn up trunk A trunk A trunk/ A trunk/gizmo.rb Updated to revision 1.

  6. Get an empty checkout of the


    directory. This is where all of the non-


    branches live, and where you’ll be making feature branches.

    svn up --depth empty branches Updated to revision 1.

Creating branches

You can also create branches using the Subversion bridge to GitHub.

From your svn client, make sure the default branch is current by updating



svn up trunk At revision 1.

Next, you can use

svn copy

to create a new branch:

svn copy trunk branches/more_awesome A branches/more_awesome svn commit -m 'Added more_awesome topic branch' Adding branches/more_awesome Committed revision 2.

You can confirm that the new branch exists in the repository’s branch dropdown:

You can also confirm the new branch via the command line:

git fetch From * [new branch] more_awesome -> origin/more_awesome

Making commits to Subversion

After you’ve added some features and fixed some bugs, you’ll want to commit those
changes to GitHub. This works just like the Subversion you’re used to. Edit your files, and use

svn commit

to record your changes:

svn status M gizmo.rb svn commit -m 'Guard against known problems' Sending more_awesome/gizmo.rb Transmitting file data . Committed revision 3. svn status ? test svn add test A test A test/gizmo_test.rb svn commit -m 'Test coverage for problems' Adding more_awesome/test Adding more_awesome/test/gizmo_test.rb Transmitting file data . Committed revision 4.

Switching between branches

To switch between branches, you’ll probably want to start with a checkout of



svn co --depth empty

Then, you can switch to another branch:

svn switch

GitLab | SVN to gitlab migration steps | okay java |
GitLab | SVN to gitlab migration steps | okay java |

What is the Git Version Control System?

Git is a distributed version control system. In this type of VCS, a project contributor creates a local repository that is a full clone of a central repository. With a local clone of the central repository, each contributor is able to work on the project completely offline on their own computer. When changes are ready, contributors can push and merge them with the central repository.

Git has immense support from the open-source community. It has quickly become one of the most used version control systems for software development projects.

Table of Contents

The majority of projects these days still use Subversion to manage their source code – true to the motto “never change a running system”. Thanks to “git-svn”, however, you can still work with Git locally in such projects.

With git-svn, you can create a Git clone from any Subversion repository, make changes, and commit those changes back to SVN without anyone knowing that you did not use a pure SVN client.

Git,SVN,Bitbucket,Github Explained
Git,SVN,Bitbucket,Github Explained



Initializes an empty Git repository with additional metadata directories for git svn. The Subversion URL may be specified as a command-line argument, or as full URL arguments to -T/-t/-b. Optionally, the target directory to operate on can be specified as a second argument. Normally this command initializes the current directory.


These are optional command-line options for init. Each of these flags can point to a relative repository path (–tags=project/tags) or a full url (–tags= You can specify more than one –tags and/or –branches options, in case your Subversion repository places tags or branches under multiple paths. The option –stdlayout is a shorthand way of setting trunk,tags,branches as the relative paths, which is the Subversion default. If any of the other options are given as well, they take precedence.


Set the noMetadata option in the [svn-remote] config. This option is not recommended, please read the svn.noMetadata section of this manpage before using this option.


Set the useSvmProps option in the [svn-remote] config.


Set the useSvnsyncProps option in the [svn-remote] config.


Set the rewriteRoot option in the [svn-remote] config.


Set the rewriteUUID option in the [svn-remote] config.


For transports that SVN handles authentication for (http, https, and plain svn), specify the username. For other transports (e.g.


), you must include the username in the URL, e.g.

svn+ssh://[email protected]/project


This allows one to specify a prefix which is prepended to the names of remotes if trunk/branches/tags are specified. The prefix does not automatically include a trailing slash, so be sure you include one in the argument if that is what you want. If –branches/-b is specified, the prefix must include a trailing slash. Setting a prefix (with a trailing slash) is strongly encouraged in any case, as your SVN-tracking refs will then be located at “refs/remotes/$prefix/”, which is compatible with Git’s own remote-tracking ref layout (refs/remotes/$remote/). Setting a prefix is also useful if you wish to track multiple projects that share a common repository. By default, the prefix is set to origin/.


Before Git v2.0, the default prefix was “” (no prefix). This meant that SVN-tracking refs were put at “refs/remotes/*”, which is incompatible with how Git’s own remote-tracking refs are organized. If you still want the old default, you can get it by passing

--prefix ""

on the command line (


may not work if your Perl’s Getopt::Long is < v2.37).


When passed to init or clone this regular expression will be preserved as a config key. See fetch for a description of




When passed to init or clone this regular expression will be preserved as a config key. See fetch for a description of




When passed to init or clone this regular expression will be preserved as a config key. See fetch for a description of




When tracking multiple directories (using –stdlayout, –branches, or –tags options), git svn will attempt to connect to the root (or highest allowed level) of the Subversion repository. This default allows better tracking of history if entire projects are moved within a repository, but may cause issues on repositories where read access restrictions are in place. Passing


will allow git svn to accept URLs as-is without attempting to connect to a higher level directory. This option is off by default when only one URL/branch is tracked (it would do little good).


Fetch unfetched revisions from the Subversion remote we are tracking. The name of the [svn-remote “…”] section in the $GIT_DIR/config file may be specified as an optional command-line argument.

This automatically updates the rev_map if needed (see $GIT_DIR/svn/**/.rev_map.* in the FILES section below for details).


Store Git commit times in the local time zone instead of UTC. This makes git log (even without –date=local) show the same times that

svn log

would in the local time zone.

This doesn’t interfere with interoperating with the Subversion repository you cloned from, but if you wish for your local Git repository to be able to interoperate with someone else’s local Git repository, either don’t use this option or you should both use it in the same local time zone.


Fetch only from the SVN parent of the current HEAD.


Ignore refs for branches or tags matching the Perl regular expression. A “negative look-ahead assertion” like


can be used to allow only certain refs.

config key: svn-remote.


If the ignore-refs configuration key is set, and the command-line option is also given, both regular expressions will be used.


This allows one to specify a Perl regular expression that will cause skipping of all matching paths from checkout from SVN. The


option should match for every fetch (including automatic fetches due to clone, dcommit, rebase, etc) on a given repository.

config key: svn-remote.


If the ignore-paths configuration key is set, and the command-line option is also given, both regular expressions will be used.



This allows one to specify a Perl regular expression that will cause the inclusion of only matching paths from checkout from SVN. The


option should match for every fetch (including automatic fetches due to clone, dcommit, rebase, etc) on a given repository.


takes precedence over



config key: svn-remote.




log entries per request when scanning Subversion history. The default is 100. For very large Subversion repositories, larger values may be needed for clone/fetch to complete in reasonable time. But overly large values may lead to higher memory usage and request timeouts.


Runs init and fetch. It will automatically create a directory based on the basename of the URL passed to it; or if a second argument is passed; it will create a directory and work within that. It accepts all arguments that the init and fetch commands accept; with the exception of




. After a repository is cloned, the fetch command will be able to update revisions without affecting the working tree; and the rebase command will be able to update the working tree with the latest changes.


Create a placeholder file in the local Git repository for each empty directory fetched from Subversion. This includes directories that become empty by removing all entries in the Subversion repository (but not the directory itself). The placeholder files are also tracked and removed when no longer necessary.


Set the name of placeholder files created by –preserve-empty-dirs. Default: “.gitignore”


This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.

This works similarly to

svn update

or git pull except that it preserves linear history with git rebase instead of git merge for ease of dcommitting with git svn.

This accepts all options that git svn fetch and git rebase accept. However,


only fetches from the current [svn-remote], and not all [svn-remote] definitions.

Like git rebase; this requires that the working tree be clean and have no uncommitted changes.

This automatically updates the rev_map if needed (see $GIT_DIR/svn/**/.rev_map.* in the FILES section below for details).


Commit each diff from the current branch directly to the SVN repository, and then rebase or reset (depending on whether or not there is a diff between SVN and head). This will create a revision in SVN for each commit in Git.

When an optional Git branch name (or a Git commit object name) is specified as an argument, the subcommand works on the specified branch, not on the current branch.

Use of dcommit is preferred to set-tree (below).


After committing, do not rebase or reset.


Commit to this SVN URL (the full path). This is intended to allow existing git svn repositories created with one transport method (e.g.




for anonymous read) to be reused if a user is later given access to an alternate transport method (e.g.




) for commit.

config key: svn-remote.

.commiturl config key: svn.commiturl (overwrites all svn-remote.

.commiturl options)

Note that the SVN URL of the commiturl config key includes the SVN branch. If you rather want to set the commit URL for an entire SVN repository use svn-remote.

.pushurl instead.

Using this option for any other purpose (don’t ask) is very strongly discouraged.


Add the given merge information during the dcommit (e.g.


). All svn server versions can store this information (as a property), and svn clients starting from version 1.5 can make use of it. To specify merge information from multiple branches, use a single space character between the branches (

--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"


config key: svn.pushmergeinfo

This option will cause git-svn to attempt to automatically populate the svn:mergeinfo property in the SVN repository when possible. Currently, this can only be done when dcommitting non-fast-forward merges where all parents but the first have already been pushed into SVN.


Ask the user to confirm that a patch set should actually be sent to SVN. For each patch, one may answer “yes” (accept this patch), “no” (discard this patch), “all” (accept all patches), or “quit”.

git svn dcommit returns immediately if answer is “no” or “quit”, without committing anything to SVN.


Create a branch in the SVN repository.


Allows to specify the commit message.


Create a tag by using the tags_subdir instead of the branches_subdir specified during git svn init.


If more than one –branches (or –tags) option was given to the init or clone command, you must provide the location of the branch (or tag) you wish to create in the SVN repository. specifies which path to use to create the branch or tag and should match the pattern on the left-hand side of one of the configured branches or tags refspecs. You can see these refspecs with the commands

git config –get-all svn-remote.

.branches git config –get-all svn-remote.



is the name of the SVN repository as specified by the -R option to init (or “svn” by default).


Specify the SVN username to perform the commit as. This option overrides the username configuration property.


Use the specified URL to connect to the destination Subversion repository. This is useful in cases where the source SVN repository is read-only. This option overrides configuration property commiturl.

git config –get-all svn-remote.



Create parent folders. This parameter is equivalent to the parameter –parents on svn cp commands and is useful for non-standard repository layouts.


Create a tag in the SVN repository. This is a shorthand for branch -t.


This should make it easy to look up svn log messages when svn users refer to -r/–revision numbers.

The following features from ‘svn log’ are supported:




is supported, non-numeric args are not: HEAD, NEXT, BASE, PREV, etc …


it’s not completely compatible with the –verbose output in svn log, but reasonably close.


is NOT the same as –max-count, doesn’t count merged/excluded commits



New features:


SVN itself only stores times in UTC and nothing else. The regular svn client converts the UTC time to the local time (or based on the TZ= environment). This command has the same behaviour.

Any other arguments are passed directly to git log


Show what revision and author last modified each line of a file. The output of this mode is format-compatible with the output of ‘svn blame’ by default. Like the SVN blame command, local uncommitted changes in the working tree are ignored; the version of the file in the HEAD revision is annotated. Unknown arguments are passed directly to git blame.


When given an SVN revision number of the form rN, returns the corresponding Git commit hash (this can optionally be followed by a tree-ish to specify which branch should be searched). When given a tree-ish, returns the corresponding SVN revision number.


Don’t require an exact match if given an SVN revision, instead find the commit corresponding to the state of the SVN repository (on the current branch) at the specified revision.


Don’t require an exact match if given an SVN revision; if there is not an exact match return the closest match searching forward in the history.


You should consider using dcommit instead of this command. Commit specified commit or tree objects to SVN. This relies on your imported fetch data being up to date. This makes absolutely no attempts to do patching when committing to SVN, it simply overwrites files with those specified in the tree or commit. All merging is assumed to have taken place independently of git svn functions.


Recursively finds the svn:ignore property on directories and creates matching .gitignore files. The resulting files are staged to be committed, but are not committed. Use -r/–revision to refer to a specific revision.


Recursively finds and lists the svn:ignore property on directories. The output is suitable for appending to the $GIT_DIR/info/exclude file.


Attempts to recreate empty directories that core Git cannot track based on information in $GIT_DIR/svn/

/unhandled.log files. Empty directories are automatically recreated when using “git svn clone” and “git svn rebase”, so “mkdirs” is intended for use after commands like “git checkout” or “git reset”. (See the svn-remote.

.automkdirs config file option for more information.)


Commits the diff of two tree-ish arguments from the command-line. This command does not rely on being inside a

git svn init

-ed repository. This command takes three arguments, (a) the original tree to diff against, (b) the new tree result, (c) the URL of the target Subversion repository. The final argument (URL) may be omitted if you are working from a git svn-aware repository (that has been


-ed with git svn). The -r

option is required for this.

The commit message is supplied either directly with the




option, or indirectly from the tag or commit when the second tree-ish denotes such an object, or it is requested by invoking an editor (see


option below).


Shows information about a file or directory similar to what ‘svn info’ provides. Does not currently support a -r/–revision argument. Use the –url option to output only the value of the URL: field.


Lists the properties stored in the Subversion repository about a given file or directory. Use -r/–revision to refer to a specific Subversion revision.


Gets the Subversion property given as the first argument, for a file. A specific revision can be specified with -r/–revision.


Sets the Subversion property given as the first argument, to the value given as the second argument for the file given as the third argument.


git svn propset svn:keywords “FreeBSD=%H” devel/py-tipper/Makefile

This will set the property svn:keywords to FreeBSD=%H for the file devel/py-tipper/Makefile.


Shows the Subversion externals. Use -r/–revision to specify a specific revision.


Compress $GIT_DIR/svn/

/unhandled.log files and remove $GIT_DIR/svn/

/index files.


Undoes the effects of fetch back to the specified revision. This allows you to re-fetch an SVN revision. Normally the contents of an SVN revision should never change and reset should not be necessary. However, if SVN permissions change, or if you alter your –ignore-paths option, a fetch may fail with “not found in commit” (file not previously visible) or “checksum mismatch” (missed a modification). If the problem file cannot be ignored forever (with –ignore-paths) the only way to repair the repo is to use reset.

Only the rev_map and refs/remotes/git-svn are changed (see $GIT_DIR/svn/**/.rev_map.* in the FILES section below for details). Follow reset with a fetch and then git reset or git rebase to move local branches onto the new tree.


Specify the most recent revision to keep. All later revisions are discarded.


Discard the specified revision as well, keeping the nearest parent instead.


Assume you have local changes in “master”, but you need to refetch “r2”.

r1—r2—r3 remotes/git-svn \ A—B master

Fix the ignore-paths or SVN permissions problem that caused “r2” to be incomplete in the first place. Then:

git svn reset -r2 -p git svn fetch

r1—r2′–r3′ remotes/git-svn \ r2—r3—A—B master

Then fixup “master” with git rebase. Do NOT use git merge or your history will not be compatible with a future dcommit!

git rebase –onto remotes/git-svn A^ master

r1—r2′–r3′ remotes/git-svn \ A’–B’ master

SVN explained

SVN has mostly found a home in development shops where teams deal with large repositories and binary files that prioritize finer access control. For instance, a lot of game development studios continue to favor centralized models for their primary use. By design, SVN provides a centralized approach to code management by storing code and related metadata in a single server. Client machines must connect to the server to retrieve a copy of the code within a particular repository.

What are SVN’s benefits?

The entirety of that code repository and its related metadata reside on that single server, with the exception of “working code” that is actively under maintenance. This means that individual clients only need to store the blocks of code they wish to alter, and can commit their changes to the server directly.

Similar to other versioning tools, SVN takes a file-centric approach to version retrieval. SVN stores the latest version of the codebase as a complete file that includes all historic changes and modifications.

SVN still maintains a record of individual past changes, but only stores the specific sections of code that were manipulated rather than a complete replication of the code repository, which is based on the process of Delta differencing. To retrieve a specific version all the delta fragments are applied sequentially on the latest version.

What are SVN’s disadvantages?

SVN’s approach does come with some drawbacks that users should be aware of. Due to its centralized design, most operations dealing with state or history will require a direct connection to the central server.

Every commit pushed to the server requires a new version of the entire repository, including the unchanged files. Pushing a commit may require both the server and client to update before the commit can go through. This is necessary in cases where a locally changed file has a newer revision on the server.

SVN adopts the concept of “branches” in order to isolate any code experiments or incomplete features and uses tags for code snapshotting. SVN also enables you to quickly retrieve versions of a code repository through the checkout process. While SVN doesn’t support nested repositories, you can still retrieve and combine changes found in multiple code repositories into one working copy of the code using the command svn:externals.

What are the main differences between GIT and SVN?
What are the main differences between GIT and SVN?

Directory structure

Each reference, or labeled snapshot of a commit, in a project is organized within specific subdirectories, such as




, and


. For example, an SVN project with two features under development might look like this:

sample_project/trunk/ sample_project/trunk/lib/widget.rb sample_project/branches/new_feature/ sample_project/branches/new_feature/lib/widget.rb sample_project/branches/another_new_feature/ sample_project/branches/another_new_feature/lib/widget.rb

An SVN workflow looks like this:

  • The


    directory represents the latest stable release of a project.
  • Active feature work is developed within subdirectories under


  • When a feature is finished, the feature directory is merged into


    and removed.

Git projects are also stored within a single directory. However, Git obscures the details of its references by storing them in a special .git directory. For example, a Git project with two features under development might look like this:

sample_project/.git sample_project/ sample_project/lib/widget.rb

A Git workflow looks like this:

  • A Git repository stores the full history of all of its branches and tags within the .git directory.
  • The latest stable release is contained within the default branch.
  • Active feature work is developed in separate branches.
  • When a feature is finished, the feature branch is merged into the default branch and deleted.

Unlike SVN, with Git the directory structure remains the same, but the contents of the files change based on your branch.

Cloning the SVN repository

You need to create a new local copy of the repository with the command


If your SVN repository follows the standard layout (trunk, branches, tags folders) you can save some typing:


git svn clone

checks out each SVN revision, one by one, and makes a git commit in your local repository in order to recreate the history. If the SVN repository has a lot of commits this will take a while, so you may want to grab a coffee.

When the command is finished you will have a full fledged git repository with a local branch called master that trackes the trunk branch in the SVN repository.

If the SVN repository has a long history, the

git svn clone

operation can crash or hang (you’ll notice the hang because the progress will stall, just kill the process with CTRL-C).
If this happens, do not worry: the git repository has been created, but there is some SVN history yet to be retrieved from the server. To resume the operation, just change to the git repository’s folder and issue the command

git svn fetch


Subversion vs Git
Subversion vs Git

git svn rebase command issues a checksum mismatch error

The solution to this problem is reset svn to the revision when the troubled file got modified for the last time, and do a git svn fetch so the SVN history is restored. The commands to perform the SVN reset are:

  • git log -1 — (copy the SVN revision number that appear in the commit message)
  • git svn reset
  • git svn fetch

You should be able to push/pull data from SVN again

Author names

Subversion identifies users only by their username, not by their full name and email address as in Git. By default, git-svn will create Git commits with just the username from SVN as Git author. New commits in Git will have your full Git user information but once you have published them to the SVN remote, this information will be replaced by the user information from SVN.

There are ways in git-svn to set up a mapping from SVN usernames to Git users, but none of these approaches (or any other) offer a viable solution to gain fully mapped author information (and that is why Tower does not provide support for configuration of author name mapping).

Don't use VSCode
Don’t use VSCode

Clone the SVN repository


git svn clone

command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.

related material
How to move a full Git repository
Learn Git with Bitbucket Cloud

Standard SVN layouts

If your SVN project uses the standard




, and


directory layout, you can use the


option instead of manually specifying the repository’s structure. Run the following command in the



git svn clone --stdlayout --authors-file=authors.txt



is the URI of the SVN repository that you want to migrate and,


is the name of the project that you want to import, and


is the directory name of the new Git repository.

For example, if you were migrating a project called


, hosted on

, you might run the following:

git svn clone --stdlayout --authors-file=authors.txt ConfluenceAsGit

Non-standard SVN layouts

If your SVN repository doesn’t have a standard layout, you need to provide the locations of your trunk, branches, and tags using the




, and


command line options. For example, if you have branches stored in both the


directory and the


directories, you would use the following command:

git svn clone --trunk=/trunk --branches=/branches

–branches=/bugfixes –tags=/tags –authors-file=authors.txt

Preserving history

SVN is configured to assume that the history of a project never changes. Git allows you to modify previous commits and changes using tools like

git rebase


GitHub supports Subversion clients, which may produce some unexpected results if you’re using both Git and SVN on the same project. If you’ve manipulated Git’s commit history, those same commits will always remain within SVN’s history. If you accidentally committed some sensitive data, we have an article that will help you remove it from Git’s history.

Note: Subversion support will be removed with GitHub version 3.13. For more information, see the GitHub blog.

An Introduction to git-svn

Legjobb Zenék 2024 ☘️ Nagy Mulatós Mix 2024 ☘️💿 Nagy Mulatós Lemez 2024 ☘️💝 Zene mindenkinek 💿💝
Legjobb Zenék 2024 ☘️ Nagy Mulatós Mix 2024 ☘️💿 Nagy Mulatós Lemez 2024 ☘️💝 Zene mindenkinek 💿💝

Linux – git: ‘svn’ is not a git command

@graue70 pointed out that on linux you need to install the git-svn command with

sudo apt install git-svn

The command git svn rebase throws an error similar to this:

Checksum mismatch:


GitSVN: Feature Comparison

Here are the biggest feature differences between Git vs. SVN. Find out which tool is better for which purposes.

Server Architecture

Server architecture is quite different between Git and SVN.

How It Works

Git software is installed on a workstation and acts as a client and a server. Every developer has a local copy of the full version history of the project on their individual machine. Git changes happen locally. So, the developer doesn’t have to be connected all the time. Once all the files are downloaded to the developer’s workstation, local operations are faster.

SVN has a separate server and client. Only the files a developer is working on are kept on the local machine, and the developer must be online, working with the server. Users check out files and commit changes back to the server.

What About Repos?

Sharing is done in central repositories, like a GitHub. And, in today’s world, enterprises have projects that span multiple repositories that include large binary files.

Storing large binary files in Git is unrealistic. Developers spend time waiting to check out the full repository onto their computer. Every time a large file is changed and committed, Git repositories grow exponentially.

Of course, there are workarounds for storing your binaries in Git, such as Git LFS. But still, every developer action leads to a mountain of change history data. This is going to slow down performance.

In SVN, only the working tree and the latest changes are checked out onto local machines. Checkouts take less time in SVN when there are a lot of changes to binary files.

SVN Is Better For Performance

When it comes to Git vs. SVN performance, the client-server model of SVN outperforms with larger files and codebases.

Back to top

Switch From SVN to a Better Tool

Many teams have switched from SVN to Helix Core. That’s because Helix Core delivers greater speed, scale, and security (and you can still use Git). See for yourself why SVN users switch. Try Helix Core for free for up to 5 users.

GitSVN Branching

SVN vs. Git branching are quite different.

How It Works

SVN branches are created as directories inside a repository. This directory structure is the core pain point with SVN branching. When the branch is ready, you commit back to the trunk.

Of course, you’re not the only one merging changes. Your version of the trunk might not reflect developers’ branches. This means conflicts, missing files, and jumbled changes riddle your branch.

This makes for a complicated branching and merging model. This is also time-consuming to manage.

Git branches are only references to a certain commit. They are lightweight — yet powerful. You can create, delete, and change a branch at any time, without affecting the commits.

If you need to test out a new feature or you find a bug, you can make a branch, make the changes, push the commit to the central repo, and then delete the branch.

Git Is Better For Branching

Developers prefer Git because of its effective branching model.

Access Controls

Access control is another key feature in the Git vs. SVN debate.

How It Works

By default, Git assumes that all the contributors have the same permissions.

On the other hand, SVN allows you to specify read and write access controls per file level and per directory level.

It’s a Toss-Up

Depending on your needs, either Git or SVN could be a better choice. Both systems take different approaches when it comes to permissions and access.


Auditability is another thing that’s different in Git vs. SVN.

How It Works

With SVN, the repository’s change history is pretty consistent. To make any change to the repository’s history, you need access to the central server. Changes are tracked at the file level.

Git’s distributed nature allows anyone to change any part of their local repository’s history. Changes are tracked at a repository level. Although pushing a changed history is heavily discouraged, it can happen. This causes problems if other developers are relying on particular changes.

In Git, the complete history of the repository is “backed up” each time a developer clones it to their computer. This natural backup mechanism is useless if neglected.

It’s a Toss-Up

You could choose Git or SVN for auditability — as long as you back it up. Making regular backups is highly encouraged with both solutions. You don’t want to be on the receiving end of a server crash without a recent copy of your shared server.

Storage Requirements

Storage is similar in Git and SVN. The disk space usage is equal for both Git and SVN repositories. The difference is what type of files can be stored in the repositories.

How It Works

Git repositories can’t handle large binary files.

SVN repositories can handle large binary files, in addition to code. Storing large binary files in SVN would take up less space than in Git.

SVN Is Better For Binaries

SVN is better at storing binary files.


Usability is another differentiator between SVN and Git.

How It Works

SVN uses the command line as the primary user interface. It is more readily used by non-programmers who want to version non-code assets. Learn more about SVN commands.

Git also uses the command line as the primary user interface. But the syntax in Git can overwhelm beginners.

SVN is Easier to Learn

SVN often considered easier to learn. This is especially true for non-technical users. They are able to catch on to common operations quickly.

Back to top

How Git Works: Explained in 4 Minutes
How Git Works: Explained in 4 Minutes



Only used with the init command. These are passed directly to git init.


Used with the fetch command.

This allows revision ranges for partial/cauterized history to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges), $NUMBER:HEAD, and BASE:$NUMBER are all supported.

This can allow you to make partial mirrors when running fetch; but is generally not recommended because history will be skipped and lost.


Only used with the set-tree command.

Read a list of commits from stdin and commit them in reverse order. Only the leading sha1 is read from each line, so git rev-list –pretty=oneline output can be used.


Only used with the dcommit, set-tree and commit-diff commands.

Remove directories from the SVN tree if there are no files left behind. SVN can version empty directories, and they are not removed by default if there are no files left in them. Git cannot version empty directories. Enabling this flag will make the commit to SVN act like Git.

config key: svn.rmdir


Only used with the dcommit, set-tree and commit-diff commands.

Edit the commit message before committing to SVN. This is off by default for objects that are commits, and forced on when committing tree objects.

config key: svn.edit


Only used with the dcommit, set-tree and commit-diff commands.

They are both passed directly to git diff-tree; see git-diff-tree[1] for more information.

config key: svn.l config key: svn.findcopiesharder


Syntax is compatible with the file used by git cvsimport but an empty email address can be supplied with <>:

loginname = Joe User

If this option is specified and git svn encounters an SVN committer name that does not exist in the authors-file, git svn will abort operation. The user will then have to add the appropriate entry. Re-running the previous git svn command after the authors-file is modified should continue operation.

config key: svn.authorsfile

If this option is specified, for each SVN committer name that does not exist in the authors file, the given file is executed with the committer name as the first argument. The program is expected to return a single line of the form “Name

” or “Name <>”, which will be treated as if included in the authors file.

Due to historical reasons a relative filename is first searched relative to the current directory for init and clone and relative to the root of the working tree for fetch. If filename is not found, it is searched like any other command in $PATH.

config key: svn.authorsProg


Make git svn less verbose. Specify a second time to make it even less verbose.


These are only used with the dcommit and rebase commands.

Passed directly to git rebase when using dcommit if a git reset cannot be used (see dcommit).


This can be used with the dcommit, rebase, branch and tag commands.

For dcommit, print out the series of Git arguments that would show which diffs would be committed to SVN.

For rebase, display the local branch associated with the upstream svn repository associated with the current branch and the URL of svn repository that will be fetched from.

For branch and tag, display the urls that will be used for copying when creating the branch or tag.

When retrieving svn commits into Git (as part of fetch, rebase, or dcommit operations), look for the first


line or


trailer in the log message and use that as the author string.

config key: svn.useLogAuthor

When committing to svn from Git (as part of set-tree or dcommit operations), if the existing log message doesn’t already have a




trailer, append a


line based on the Git commit’s author string. If you use this, then


will retrieve a valid author string for all commits.

config key: svn.addAuthorFrom


SVN and Git are both powerful version control systems that each use a different approach to managing and merging code changes. Git uses a distributed model, whereas SVN uses a centralized model. Which VCS that you choose largely depends on your software development project’s requirements. After reading this guide, you should be able to select the best version control system for your needs.

This page was originally published on

Git convert: A step in migration from SVN to Git

The next step in the migration from SVN to Git is to import the contents of the SVN repository into a new Git repository. We’ll do this with the

git svn

utility that is included with most Git distributions, then we’ll clean up the results with



Beware that the conversion process can take a significant amount of time for larger repositories, even when cloning from a local SVN repository. As a benchmark, converting a 400MB repository with 33,000 commits on main took around 12 hours to complete.

For reasonably sized repositories, the following steps should be run on the migration lead’s local computer. However, if you have a very large SVN repository and want to cut down on the conversion time, you can run

git svn clone

on the SVN server instead of on the migration lead’s local machine. This will avoid the overhead of cloning via a network connection.

So You Think You Know Git - FOSDEM 2024
So You Think You Know Git – FOSDEM 2024

Finding the Git commit SHA for a Subversion commit

GitHub’s Subversion server exposes the Git commit sha for each Subversion commit.

To see the commit SHA, you should ask for the


unversioned remote property.

svn propget git-commit --revprop -r HEAD 05fcc584ed53d7b0c92e116cb7e64d198b13c4e3

With this commit SHA, you can, for example, look up the corresponding Git commit on GitHub.

What Is Subversion? SVN Explained

Subversion (SVN) is one of many version control options available today. Here, we will provide a comprehensive overview of what Subversion is, the history of Subversion software, what an SVN repository is, and potential drawbacks you should consider before switching to SVN.

Read along or jump to the section that interests you the most:

Table of Contents

➡️ Easily Switch to Helix Core

Back to top


We ignore all SVN properties except svn:executable. Any unhandled properties are logged to $GIT_DIR/svn/


Renamed and copied directories are not detected by Git and hence not tracked when committing to SVN. I do not plan on adding support for this as it’s quite difficult and time-consuming to get working for all the possible corner cases (Git doesn’t do it, either). Committing renamed and copied files is fully supported if they’re similar enough for Git to detect them.

In SVN, it is possible (though discouraged) to commit changes to a tag (because a tag is just a directory copy, thus technically the same as a branch). When cloning an SVN repository, git svn cannot know if such a commit to a tag will happen in the future. Thus it acts conservatively and imports all SVN tags as branches, prefixing the tag name with tags/.

MÌNH ĐÃ BUILD KIT 400K NHƯ THẾ NÀO?? - Review mỏng VGN V87 1 Mode!!!
MÌNH ĐÃ BUILD KIT 400K NHƯ THẾ NÀO?? – Review mỏng VGN V87 1 Mode!!!

File was not found in commit

When you try to fetch or pull from SVN you get an error similar to this

was not found in commit

This means that a revision in SVN is trying to modify a file that for some reason doesn’t exists in your local copy. The best way to get rid of this error is force a fetch ignoring the path of that file and it will updated to its status in the latest SVN revision:

  • git svn fetch --ignore-paths

(thanks @rykus0 for pointing out that –ignore-paths actually accepts a regex, not a file-path)

Đăng nhập/Đăng ký
Cộng đồng
Kiến thức
Khoa học máy tính
21 tháng 04, 2022
16:49 21/04/2022

SVN hay Git: đâu là giải pháp phù hợp cho lập trình viên
Cùng tác giả
Không có dữ liệu
2995 người theo dõi
Có liên quan
Không có dữ liệu
Chia sẻ kiến thức – Kết nối tương lai
Về chúng tôi
Về chúng tôi
Giới thiệu
Chính sách bảo mật
Điều khoản dịch vụ
Học miễn phí
Học miễn phí
Khóa học
Luyện tập
Cộng đồng
Cộng đồng
Kiến thức
Tin tức
Hỏi đáp
The Manor Central Park, đường Nguyễn Xiển, phường Đại Kim, quận Hoàng Mai, TP. Hà Nội
[email protected]
©2024 TEK4.VN
Copyright © 2024

Git vs SVN: What Is The Difference?

Git vs. SVN — what is the difference? Here we will explain the difference between the two, as well as what is Git SVN?

➡️ Skip Git and SVN — Try Helix Core

Back to top

Git explained

In contrast between Git and SVN, Git uses a decentralized model and tries to address the needs of large-scale software projects. All git nodes share an equitable relationship as all the data, metadata and history is replicated across participating nodes. A node can be designated as a server for centralized push and pull of code, but that is not a prerequisite. Git is designed to support peer-to-peer exchange of data without a central server.

What are Git’s advantages?

In addition to its decentralized design, Git does not take a file-centric view for version management. Git looks at the changes made to files together and creates a blob of changes to store them locally. Every change is stored as a set of object IDs, blob (the content of a file), tree directory listing and a committed snapshot. This prevents the size bloat for a repository over time. Commit snapshot stores metadata like author email, date and parent tree. All metadata is organized within the .git folder at the root level and the storage design and navigation is efficient. Git also supports nested repositories using git submodules.

Due to its design choices, Git is fast, decentralized and supports non-linear commit sequences. Git repositories can be forked and cloned by multiple client nodes. Web platforms like GitHub and GitLab enable downstream forks to submit changes upstream. This model scales and works well for projects that are contributed to by large communities of people. It is also one of the reasons for the adoption of code management platforms like GitHub and GitLab for open source development.

What are Git’s drawbacks?

While Git has several benefits, its command-line interface (CLI) options can be a bit overwhelming. To unleash its full power requires a solid understanding of git internals. And, because git stores all data locally, repositories containing large binary files tend to be cumbersome to work.

To handle these large repositories, you’ll need an extension like Git-LFS (large file storage) that pushes cumbersome project files to a remote data store, allowing the git project itself to only store references.

A major difference between Git and SVN is that Git has a simpler CLI that pulls down large binary files only when they are being modified. But it relies on a central server connected over a network and can offer only limited functionality without connectivity.

Additionally, in a centralized model, all contributors must have access to the centralized repository. This makes it limiting for use in public projects contributed by large communities. Git was originally authored to address some of these issues.

Setup and Config

Getting and Creating Projects

Basic Snapshotting

Branching and Merging

Sharing and Updating Projects

Inspection and Comparison



External Systems

Server Admin


  • gitattributes
  • Command-line interface conventions
  • Everyday Git
  • Frequently Asked Questions (FAQ)
  • Glossary
  • Hooks
  • gitignore
  • gitmodules
  • Revisions
  • Submodules
  • Tutorial
  • Workflows
  • All guides…


Plumbing Commands

  1. 2.35.1 → 2.43.1 no changes
  2. 2.35.0
  3. 2.34.1 → 2.34.8 no changes
  4. 2.34.0
  5. 2.32.1 → 2.33.8 no changes
  6. 2.32.0
  7. 2.30.1 → 2.31.8 no changes
  8. 2.30.0
How to configure a web server in Android with Termux - LAMP server (MySQL PHP) & WordPress - No Root
How to configure a web server in Android with Termux – LAMP server (MySQL PHP) & WordPress – No Root

Including subprojects

A subproject is a project that’s developed and managed somewhere outside of your main project. You typically import a subproject to add some functionality to your project without needing to maintain the code yourself. Whenever the subproject is updated, you can synchronize it with your project to ensure that everything is up-to-date.

In SVN, a subproject is called an SVN external. In Git, it’s called a Git submodule. Although conceptually similar, Git submodules are not kept up-to-date automatically; you must explicitly ask for a new version to be brought into your project.

For more information, see “Git Tools Submodules” in the Git documentation.




This gets rid of the git-svn-id: lines at the end of every commit.

This option can only be used for one-shot imports as git svn will not be able to fetch again without metadata. Additionally, if you lose your $GIT_DIR/svn/**/.rev_map.* files, git svn will not be able to rebuild them.

The git svn log command will not work on repositories using this, either. Using this conflicts with the useSvmProps option for (hopefully) obvious reasons.

This option is NOT recommended as it makes it difficult to track down old references to SVN revision numbers in existing documentation, bug reports, and archives. If you plan to eventually migrate from SVN to Git and are certain about dropping SVN history, consider git-filter-repo instead. filter-repo also allows reformatting of metadata for ease-of-reading and rewriting authorship info for non-“svn.authorsFile” users.



This allows git svn to re-map repository URLs and UUIDs from mirrors created using SVN::Mirror (or svk) for metadata.

If an SVN revision has a property, “svm:headrev”, it is likely that the revision was created by SVN::Mirror (also used by SVK). The property contains a repository UUID and a revision. We want to make it look like we are mirroring the original URL, so introduce a helper function that returns the original identity URL and UUID, and use it when generating metadata in commit messages.



Similar to the useSvmProps option; this is for users of the svnsync(1) command distributed with SVN 1.4.x and later.



This allows users to create repositories from alternate URLs. For example, an administrator could run git svn on the server locally (accessing via file://) but wish to distribute the repository with a public http:// or svn:// URL in the metadata so users of it will see the public URL.



Similar to the useSvmProps option; this is for users who need to remap the UUID manually. This may be useful in situations where the original UUID is not available via either useSvmProps or useSvnsyncProps.



Similar to Git’s



, this key is designed to be used in cases where url points to an SVN repository via a read-only transport, to provide an alternate read/write transport. It is assumed that both keys point to the same repository. Unlike commiturl, pushurl is a base path. If either commiturl or pushurl could be used, commiturl takes precedence.


This disables potentially expensive checks to workaround broken symlinks checked into SVN by broken clients. Set this option to “false” if you track a SVN repository with many empty blobs that are not symlinks. This option may be changed while git svn is running and take effect on the next revision fetched. If unset, git svn assumes this option to be “true”.


This instructs git svn to recode pathnames to a given encoding. It can be used by windows users and by those who work in non-utf8 locales to avoid corrupted file names with non-ASCII characters. Valid encodings are the ones supported by Perl’s Encode module.



Normally, the “git svn clone” and “git svn rebase” commands attempt to recreate empty directories that are in the Subversion repository. If this option is set to “false”, then empty directories will only be created if the “git svn mkdirs” command is run explicitly. If unset, git svn assumes this option to be “true”.

Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps options all affect the metadata generated and used by git svn; they must be set in the configuration file before any history is imported and these settings should never be changed once they are set.

Additionally, only one of these options can be used per svn-remote section because they affect the git-svn-id: metadata line, except for rewriteRoot and rewriteUUID which can be used together.

SVN tutorial for beginner | tortoiseSVN
SVN tutorial for beginner | tortoiseSVN


Transitioning your team to Git can be a daunting task, but it doesn’t have to be. This article introduced some of the common options for migrating your existing codebase, rolling out Git to your development teams, and dealing with security and permissions. We also introduced the biggest challenges that your developers should be prepared for during the migration process.

Hopefully, you now have a solid foundation for introducing distributed development to your company, regardless of its size or current development practices.

Share this article
Next Topic


In this step, you turned an SVN repository into a new Git repository with the

git svn clone

command, then cleaned up the structure of the resulting repository with


. In the next step, you’ll learn how to keep this new Git repo in sync with any new commits to the SVN repository. This will be a similar process to the conversion, but there are some important workflow considerations during this transition period.

Share this article
Next Topic
Git Worktrees and Neovim: A Match Made in Coding Heaven
Git Worktrees and Neovim: A Match Made in Coding Heaven

Recommended reading

Bookmark these resources to learn about types of DevOps teams, or for ongoing updates about DevOps at Atlassian.

Bitbucket blog
DevOps learning path

GitHub supports Subversion clients via the HTTPS protocol. We use a Subversion bridge to communicate svn commands to GitHub.

Note: Subversion support will be removed with GitHub version 3.13. For more information, see the GitHub blog.

For developers

A repository for every developer

As a developer, the biggest change you’ll need to adjust to is the distributed nature of Git. Instead of a single central repository, every developer has their own copy of the entire repository. This dramatically changes the way you collaborate with your fellow programmers.

Instead of checking out an SVN repository with svn checkout and getting a working copy, you clone the entire Git repository to your local machine with git clone.

Collaboration occurs by moving branches between repositories with either git push, git fetch, or git pull. Sharing is commonly done on the branch level in Git but can be done on the commit level, similar to SVN. But in Git, a commit represents the entire state of the whole project instead rather than file modifications. Since you can use branches in both Git and SVN, the important distinction here is that you can commit locally with Git, without sharing your work. This enables you to experiment more freely, work more effectively offline and speeds up almost all version control related commands.

However, it’s important to understand that a remote repository is not a direct link into somebody else’s repository. It’s simply a bookmark that prevents you from having to re-type the full URL each time you interact with a remote repository. Until you explicitly pull or push a branch to a remote repository, you’re working in an isolated environment.

The other big adjustment for SVN users is the notion of “local” and “remote” repositories. Local repositories are on your local machine, and all other repositories are referred to as remote repositories. The main purpose of a remote repository is to make your code accessible to the rest of the team, and thus no active development takes place in them. Local repositories reside on your local machine, and it’s where you do all of your software development.

Don’t be scared of branching or merging

In SVN, you commit code by editing files in your working copy, then running svn commit to send the code to the central repository. Everybody else can then pull those changes into their own working copies with svn update. SVN branches are usually reserved for large, long-running aspects of a project because merging is a dangerous procedure that has the potential to break the project.

Git’s basic development workflow is much different. Instead of being bound to a single line of development (e.g., trunk/), life revolves around branching and merging.

When you want to start working on anything in Git, you create and check out a new branch with git checkout -b . This gives you a dedicated line of development where you can write code without worrying about affecting anyone else on your team. If you break something beyond repair, you simply throw the branch away with git branch -d . If you build something useful, you file a pull request asking to merge it into the main branch.

Potential Git workflows

When choosing a Git workflow it is important to consider your team’s needs. A simple workflow can maximise development speed and flexibility, while a more complex workflow can ensure greater consistency and control of work in progress. You can adapt and combine the general approaches listed below to suit your needs and the different roles on your team. A core developer might use feature branches while a contractor works from a fork, for example.

  • A centralized workflow provides the closest match to common SVN processes, so it’s a good option to get started.
  • Building on that idea, using a feature branch workflow lets developers keep their work in progress isolated and important shared branches protected. Feature branches also form the basis for managing changes via pull requests.
  • A Gitflow workflow is a more formal, structured extension to feature branching, making it a great option for larger teams with well-defined release cycles.
  • Finally, consider a forking workflow if you need maximum isolation and control over changes, or have many developers contributing to one repository.

But, if you really want to get the most out of Git as a professional team, you should consider the feature branch workflow. This is a truly distributed workflow that is highly secure, incredibly scalable, and quintessentially agile.

Git Tutorial For Dummies
Git Tutorial For Dummies

Is Subversion a Distributed Version Control System?

Subversion is actually a centralized version control system. SVN is different from distributed systems, like Git.

Subversion (SVN) Server Explained

Centralized version control means that the version history is stored in a central server which requires developers to connect with the server as they are making changes.

When a developer wants to make changes to certain files, they pull files from that central server to their own computer. After the developer has made changes, they send the changed files back to the central server.

Back to top

Local work

Just use your local git repository as a normal git repo, with the normal git commands

  • git add FILE


    git checkout -- FILE

    To stage/unstage a file

  • git commit

    To save your changes. Those commits will be local and will not be “pushed” to the SVN repo

  • git stash


    git stash pop

    Hell yeah! Stashes are back!

  • git reset HEAD --hard

    Revert all your local changes

  • git log

    Access all the history in the repository

  • git rebase -i

    Yep, you can squash all the commits! (as usual be SUPER CAREFULL with this one)

  • git branch

    Yes! you can create local branches! But remember to keep the history linear!
Compiling C# into NATIVE code, just like Go, Rust and C++
Compiling C# into NATIVE code, just like Go, Rust and C++

Basic Git commands

Git once had a reputation for a steep learning curve. However the Git maintainers have been steadily releasing new improvements like sensible defaults and contextual help messages that have made the on-boarding process a lot more pleasant.

Atlassian offers a comprehensive series of self-paced Git tutorials, as well as webinars and live training sessions. Together, these should provide all the training options your team needs to get started with Git. To get you started, here are a list of some basic Git commands to get you going with Git:

related material
How to move a full Git repository
Learn Git with Bitbucket Cloud
Git task
Git commands


Configure the author name and email address to be used with your commits.Note that Git strips some characters (for example trailing periods) from

Git commands

git config –global “Sam Smith”git config –global [email protected]


Git commands

git init


Create a working copy of a local repository:

Git commands

git clone /path/to/repository


For a remote server, use:

Git commands

git clone username@host:/path/to/repository


Add one or more files to staging (index):

Git commands

git add *


Commit changes to head (but not yet to the remote repository):

Git commands

git commit -m “Commit message”


Commit any files you’ve added with git add, and also commit any files you’ve changed since then:

Git commands

git commit -a


Send changes to the main branch of your remote repository:

Git commands

git push origin main


List the files you’ve changed and those you still need to add or commit:

Git commands

git status


If you haven’t connected your local repository to a remote server, add the server to be able to push to it:

Git commands

git remote add origin


List all currently configured remote repositories:

Git commands

git remote -v


Create a new branch and switch to it:

Git commands

git checkout -b


Switch from one branch to another:

Git commands

git checkout


List all the branches in your repo, and also tell you what branch you’re currently in:

Git commands

git branch


Delete the feature branch:

Git commands

git branch -d


Push the branch to your remote repository, so others can use it:

Git commands

git push origin


Push all branches to your remote repository:

Git commands

git push –all origin


Delete a branch on your remote repository:

Git commands

git push origin :


Fetch and merge changes on the remote server to your working directory:

Git commands

git pull


To merge a different branch into your active branch:

Git commands

git merge


View all the merge conflicts:View the conflicts against the base file:Preview changes, before merging:

Git commands

git diffgit diff –basegit diff


After you have manually resolved any conflicts, you mark the changed file:

Git commands

git add



You can use tagging to mark a significant changeset, such as a release:

Git commands

git tag 1.0.0


CommitId is the leading characters of the changeset ID, up to 10, but must be unique. Get the ID using:

Git commands

git log


Push all tags to remote repository:

Git commands

git push –tags origin


If you mess up, you can replace the changes in your working tree with the last content in head:Changes already added to the index, as well as new files, will be kept.

Git commands

git checkout —


Instead, to drop all your local changes and commits, fetch the latest history from the server and point your local main branch at it, do this:

Git commands

git fetch origingit reset –hard origin/main



Search the working directory for foo():

Git commands

git grep “foo()”

What is SVN?

Apache Subversion (SVN), is a centralized version control system. When working with this type of VCS, all project files exist on a central repository server. The central repository has a “trunk,” which contains the current, stable version of the project. When working on new features, contributors can make “branches” from the trunk. Each branch is stored in a sub-folder on the central repository. When changes are ready, a branch can be merged into the trunk.

SVN has a long and successful history and stands as a titan in the version control world. It has widespread usage for enterprise projects, with features like granular access control that make it excel in that context.

Difference between Git, SVN and Mercurial version control system | #git #svn #mercurial #programming
Difference between Git, SVN and Mercurial version control system | #git #svn #mercurial #programming

Making changes

Here is the one thing you should be aware of if you do not want to annoy SVN users on the other side of the repository:

If you create branches in Git to make your changes (probably the reason why you have chosen to work with git-svn), you have to either squash-merge your changes back to the original branch or rebase with the original branch before merging. If you squash-merge, you will lose individual commits while rebasing will preserve them.

Let us take a look at an example: You create a new branch develop from master and add two files FOO and BAR in two separate commits. If you merge them back and a merge commit is created, only the merge commit itself will be visible to other SVN (or git-svn) users.

The following two images show the history as it appears in the Git repository and in the SVN repository after both repositories have been synchronized.

As you can see, all changes will be there, but the individual commit information is lost as SVN will never receive and thus not know about the commits of the other branch.

Git migration tools

There’s a number of tools available to help you migrate your existing projects from SVN to Git, but before you decide what tools to use, you need to figure out how you want to migrate your code. Your options are:

  • Migrate your entire codebase to Git and stop using SVN altogether.
  • Don’t migrate any existing projects to Git, but use Git for all new projects.
  • Migrate some of your projects to Git while continuing to use SVN for other projects.
  • Use SVN and Git simultaneously on the same projects.

A complete transition to Git limits the complexity in your development workflow, so this is the preferred option. However, this isn’t always possible in larger companies with dozens of development teams and potentially hundreds of projects. In these situations, a hybrid approach is a safer option.

Your choice of migration tool(s) depends largely on which of the above strategies you choose. Some of the most common SVN-to-Git migration tools are introduced below.

Atlassian’s migration scripts

If you’re interested in making an abrupt transition to Git, Atlassian’s migration scripts are a good choice for you. These scripts provide all the tools you need to reliably convert your existing SVN repositories to Git repositories. The resulting native-Git history ensures you won’t need to deal with any SVN-to-Git interoperability issues after the conversion process.

We’ve provided a complete technical walkthrough for using these scripts to convert your entire codebase to a collection of Git repositories. This walkthrough explains everything from extracting SVN author information to re-organizing non-standard SVN repository structures.

SVN Mirror for Stash (now Bitbucket) plugin

SVN Mirror for Stash is a Bitbucket plugin that lets you easily maintain a hybrid codebase that works with both SVN and Git. Unlike Atlassian’s migration scripts, SVN Mirror for Stash lets you use Git and SVN simultaneously on the same project for as long as you like.

This compromise solution is a great option for larger companies. It enables incremental Git adoption by letting different teams migrate workflows at their convenience.

What is Git-SVN?

The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior. This should be temporary, but is helpful when debating making the switch from SVN to Git.

git svn is a good option if you’re not sure about making the switch to Git and want to let some of your developers explore Git commands without committing to a full-on migration. It’s also perfect for the training phase—instead of an abrupt transition, your team can ease into it with local Git commands before worrying about collaboration workflows.

Note that git svn should only be a temporary phase of your migration process. Since it still depends on SVN for the “backend,” it can’t leverage the more powerful Git features like branching or advanced collaboration workflows.

Rollout strategies

Migrating your codebase is only one aspect of adopting Git. You also need to consider how to introduce Git to the people behind that codebase. External consultants, internal Git champions, and pilots teams are the three main strategies for moving your development team over to Git.

External Git consultants

Git consultants can essentially handle the migration process for you for a nominal fee. This has the advantage of creating a Git workflow that’s perfectly suited to your team without investing the time to figure it out on your own. It also makes expert training resources available to you while your team is learning Git. Atlassian Partners are pros when it comes to SVN to Git migration and are a good resource for sourcing a Git consultant.

On the other hand, designing and implementing a Git workflow on your own is a great way for your team to understand the inner workings of their new development process. This avoids the risk of your team being left in the dark when your consultant leaves.

Internal Git champions

A Git champion is a developer inside of your company who’s excited to start using Git. Leveraging a Git champion is a good option for companies with a strong developer culture and eager programmers comfortable being early adopters. The idea is to enable one of your engineers to become a Git expert so they can design a Git workflow tailored to your company and serve as an internal consultant when it’s time to transition the rest of the team to Git.

Compared to an external consultant, this has the advantage of keeping your Git expertise in-house. However, it requires a larger time investment to train that Git champion, and it runs the risk of choosing the wrong Git workflow or implementing it incorrectly.

Pilot teams

The third option for transitioning to Git is to test it out on a pilot team. This works best if you have a small team working on a relatively isolated project. This could work even better by combining external consultants with internal Git champions in the pilot team for a winning combo.

This has the advantage of requiring buy-in from your entire team, and also limits the risk of choosing the wrong workflow, since it gets input from the entire team while designing the new development process. In other words, it ensures any missing pieces are caught sooner than when a consultant or champion designs the new workflow on their own.

On the other hand, using a pilot team means more initial training and setup time: instead of one developer figuring out a new workflow, there’s a whole team that could potentially be temporarily less productive while they’re getting comfortable with their new workflow. However, this short term pain is absolutely worth the long term gain.

Security and permissions

Access control is an aspect of Git where you need to fundamentally re-think how you manage your codebase.

In SVN, you typically store your entire codebase in a single central repository, then limit access to different teams or individuals by folder. In Git, this is not possible: developers must retrieve the entire repository to work with it. You typically can not retrieve a subset of the repository, as you can with SVN. permissions can only be granted to entire Git repositories.

This means you have to split up your large, monolithic SVN repository into several small Git repositories. We actually experienced this first hand here at Atlassian when our Jira development team migrated to Git. All of our Jira plugins used to be stored in a single SVN repository, but after the migration, each plugin ended up in its own repository.

Keep in mind that Git was designed to securely integrate code contributions from thousands of independent Linux developers, so it definitely provides some way to set up whatever kind of access control your team needs. This may, however, require a fresh look at your build cycle.

If you’re concerned about maintaining dependencies between your new collection of Git repositories, you may find a dependency management layer on top of Git helpful. A dependency management layer will help with build times because as a project grows, you need “caching” in order to speed up your build time. A list of recommended dependency management layer tools for every technology stack can be found in this helpful article: “Git and project dependencies”.

What Is Version Control? | Git Version Control | Version Control In Software Engineering|Simplilearn
What Is Version Control? | Git Version Control | Version Control In Software Engineering|Simplilearn


Prefer to use git svn rebase or git rebase, rather than git pull or git merge to synchronize unintegrated commits with a git svn branch. Doing so will keep the history of unintegrated commits linear with respect to the upstream SVN repository and allow the use of the preferred git svn dcommit subcommand to push unintegrated commits back into SVN.

Originally, git svn recommended that developers pulled or merged from
the git svn branch. This was because the author favored

git svn set-tree B

to commit a single head rather than the

git svn set-tree A..B

notation to commit multiple commits. Use of
git pull or git merge with

git svn set-tree A..B

will cause non-linear
history to be flattened when committing into SVN and this can lead to merge
commits unexpectedly reversing previous commits in SVN.

Cloning SVN repositories

To clone an SVN repository, just provide the URL of the SVN repository (along with your credentials if the SVN repository requires authentication).If the directory layout of your SVN repository does not follow the SVN standard directory layout (trunk, branches, and tags directories), you need to provide additional path information on where your main branch, branches, and tags reside so git-svn can create remote branches for them.

You need to be patient: Cloning a large SVN repository can take some time as git-svn needs to import all revisions.

Centralized vs Distributed Version Control in 90 seconds
Centralized vs Distributed Version Control in 90 seconds

Which Should You Use?

Each of the version control systems covered here — SVN and Git — has its particular strengths and weaknesses. Each one fits different use cases better than the other, and neither one wins out over the other one outright.

  • Use SVN when you need a VCS that favors top-down management, easy contributions, and does not require you to work entirely offline. SVN often comes out on top for enterprise usage specifically for its granular access control, and it is the clear choice if you need to set up security hierarchies.

    To get started with SVN, be sure to read through our guide How to Install and Use the Subversion CLI Client.

  • Use Git when you need numerous contributors to work in parallel, where you expect lots of potential merge conflicts, and when you need contributors to be able to work locally offline. Because it handles merge conflicts, Git makes sense for most open-source projects, where contributors often work without external coordination. Git shines in a wide range of environments with complex codebases and distributed teams.

    To learn more and start working with Git, check out our guide Getting Started with Git.

Getting the latest changes from SVN

The equivalent to

git pull

is the command

git svn rebase


This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches 🙂

You can also use

git svn fetch

to retrieve the changes from the SVN repository but without applying them to your local branch.

Git,SVN,Bitbucket,Github Explained
Git,SVN,Bitbucket,Github Explained


For the sake of simplicity and interoperating with Subversion, it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between Git repositories and branches. The recommended method of exchanging code between Git branches and users is git format-patch and git am, or just ‘dcommit’ing to the SVN repository.

Running git merge or git pull is NOT recommended on a branch you plan to dcommit from because Subversion users cannot see any merges you’ve made. Furthermore, if you merge or pull from a Git branch that is a mirror of an SVN branch, dcommit may commit to the wrong branch.

If you do merge, note the following rule: git svn dcommit will attempt to commit on top of the SVN commit named in

git log –grep=^git-svn-id: –first-parent -1

You must therefore ensure that the most recent commit of the branch you want to dcommit to is the first parent of the merge. Chaos will ensue otherwise, especially if the first parent is an older commit on the same SVN branch.

git clone does not clone branches under the refs/remotes/ hierarchy or any git svn metadata, or config. So repositories created and managed with using git svn should use rsync for cloning, if cloning is to be done at all.

Since dcommit uses rebase internally, any Git branches you git push to before dcommit on will require forcing an overwrite of the existing ref on the remote repository. This is generally considered bad practice, see the git-push[1] documentation for details.

Do not use the –amend option of git-commit[1] on a change you’ve already dcommitted. It is considered bad practice to –amend commits you’ve already pushed to a remote repository for other users, and dcommit with SVN is analogous to that.

When cloning an SVN repository, if none of the options for describing
the repository layout is used (–trunk, –tags, –branches,
–stdlayout), git svn clone will create a Git repository with
completely linear history, where branches and tags appear as separate
directories in the working copy. While this is the easiest way to get a
copy of a complete repository, for projects with many branches it will
lead to a working copy many times larger than just the trunk. Thus for
projects using the standard directory structure (trunk/branches/tags),
it is recommended to clone with option


. If the project
uses a non-standard structure, and/or if branches and tags are not
required, it is easiest to only clone one directory (typically trunk),
without giving any repository layout options. If the full history with
branches and tags is required, the options






must be used.

When using multiple –branches or –tags, git svn does not automatically handle name collisions (for example, if two branches from different paths have the same name, or if a branch and a tag have the same name). In these cases, use init to set up your Git repository then, before your first fetch, edit the $GIT_DIR/config file so that the branches and tags are associated with different name spaces. For example:

branches = stable/*:refs/remotes/svn/stable/* branches = debug/*:refs/remotes/svn/debug/*

How Does Subversion Work?

Now that we’ve answered the question, “What is SVN?” let’s dive into the question, “How does Subversion software work?” Here is an overview of how SVN works.

SVN originally was designed as a command line interface. This means you would open your Terminal and type text commands.

For Subversion to work, the SVN setup needs two main elements:

  • The server, which has all versions of all source files
  • A local copy of the files, which is on your computer

The files on your computer are called working files. These are the files in which each user makes edits. Then, users commit their changes to the SVN server.

Each time a user commits a change, SVN manages and records it by creating a new version. Like most version control options, users typically work with the most recent version. But if an older version is needed, you can revert to an earlier version.

Back to top

Git vs. GitHub: What's the difference?
Git vs. GitHub: What’s the difference?


git svn stores [svn-remote] configuration information in the repository $GIT_DIR/config file. It is similar the core Git [remote] sections except fetch keys do not accept glob arguments; but they are instead handled by the branches and tags keys. Since some SVN repositories are oddly configured with multiple projects glob expansions such those listed below are allowed:

[svn-remote “project-a”] url = fetch = trunk/project-a:refs/remotes/project-a/trunk branches = branches/*/project-a:refs/remotes/project-a/branches/* branches = branches/release_*:refs/remotes/project-a/branches/release_* branches = branches/re*se:refs/remotes/project-a/branches/* tags = tags/*/project-a:refs/remotes/project-a/tags/*

Keep in mind that the (asterisk) wildcard of the local ref
(right of the ) must be the farthest right path component;
however the remote wildcard may be anywhere as long as it’s an
independent path component (surrounded by or EOL). This
type of configuration is not automatically created by init and
should be manually entered with a text-editor or using git config.

Also note that only one asterisk is allowed per word. For example:

branches = branches/re*se:refs/remotes/project-a/branches/*

will match branches release, rese, re123se, however

branches = branches/re*s*e:refs/remotes/project-a/branches/*

will produce an error.

It is also possible to fetch a subset of branches or tags by using a comma-separated list of names within braces. For example:

[svn-remote “huge-project”] url = fetch = trunk/src:refs/remotes/trunk branches = branches/{red,green}/src:refs/remotes/project-a/branches/* tags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/*

Multiple fetch, branches, and tags keys are supported:

[svn-remote “messy-repo”] url = fetch = trunk/project-a:refs/remotes/project-a/trunk fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo branches = branches/server/*:refs/remotes/project-a/branches/* branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/* tags = tags/server/*:refs/remotes/project-a/tags/*

Creating a branch in such a configuration requires disambiguating which location to use using the -d or –destination flag:

$ git svn branch -d branches/server release-2-3-0

Note that git-svn keeps track of the highest revision in which a branch or tag has appeared. If the subset of branches or tags is changed after fetching, then $GIT_DIR/svn/.metadata must be manually edited to remove (or reset) branches-maxRev and/or tags-maxRev as appropriate.

GitSVN Commands

Here’s a quick comparison of Git vs. SVN commands — and how to use them.


SVN Commands

Git Commands

Create a new repository.

svnadmin create

git init

Copy files into the client workspace.

svn checkout

git clone or git fetch

Send changes to the depot.

svn commit

git commit

Add a new file.

svn import

git add

Compare changes to files.

svn diff

git diff

More Commands

Back to top

Part 2: SVN (Subversion) to Git Migration
Part 2: SVN (Subversion) to Git Migration


Tracking and contributing to the trunk of a Subversion-managed project (ignoring tags and branches):

# Clone a repo (like git clone): git svn clone # Enter the newly cloned directory: cd trunk # You should be on master branch, double-check with ‘git branch’ git branch # Do some work and commit locally to Git: git commit … # Something is committed to SVN, rebase your local changes against the # latest changes in SVN: git svn rebase # Now commit your changes (that were committed previously using Git) to SVN, # as well as automatically updating your working HEAD: git svn dcommit # Append svn:ignore settings to the default Git exclude file: git svn show-ignore >> .git/info/exclude

Tracking and contributing to an entire Subversion-managed project (complete with a trunk, tags and branches):

# Clone a repo with standard SVN directory layout (like git clone): git svn clone –stdlayout –prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone -T tr -b branch -t tag –prefix svn/ # View all branches and tags you have cloned: git branch -r # Create a new branch in SVN git svn branch waldo # Reset your master to trunk (or any other branch, replacing ‘trunk’ # with the appropriate name): git reset –hard svn/trunk # You may only dcommit to one branch/tag/trunk at a time. The usage # of dcommit/rebase/show-ignore should be the same as above.

The initial git svn clone can be quite time-consuming (especially for large Subversion repositories). If multiple people (or one person with multiple machines) want to use git svn to interact with the same Subversion repository, you can do the initial git svn clone to a repository on a server and have each person clone that repository with git clone:

# Do the initial import on a server ssh server “cd /pub && git svn clone [options…]” # Clone locally – make sure the refs/remotes/ space matches the server mkdir project cd project git init git remote add origin server:/pub/project git config –replace-all remote.origin.fetch ‘+refs/remotes/*:refs/remotes/*’ git fetch # Prevent fetch/pull from remote Git server in the future, # we only want to use git svn for future updates git config –remove-section remote.origin # Create a local branch from one of the branches just fetched git checkout -b master FETCH_HEAD # Initialize ‘git svn’ locally (be sure to use the same URL and # –stdlayout/-T/-b/-t/–prefix options as were used on server) git svn init [options…] # Pull the latest changes from Subversion git svn rebase

Is Subversion (SVN) Still Used?

Subversion software used to be one of the most popular systems. But SVN’s popularity is waning. Many businesses chose SVN to save costs. Subversion was initially appealing since it is open source and was able to work with these businesses’ original scale and project needs.

Switch From Subversion (SVN) to a Better Tool

Many teams have migrated from Subversion (SVN) to Helix Core. That’s because Helix Core delivers greater speed, scale, and security than SVN can. See for yourself why SVN users switch. Try Helix Core for free for up to 5 users.

Is Subversion (SVN) Stable?

Subversion software is not able to scale as projects expand and file sizes increase. In addition, Subversion becomes harder to work with and inconvenient as teams grow larger and more distributed.

These factors make SVN an unstable and unreliable version control system.

📘 Related Resource: Tales from Ex SVN Users

Back to top

[程序员小飞]10分钟理解SVN和Git | SVN和Git的区别|Git新手教程
[程序员小飞]10分钟理解SVN和Git | SVN和Git的区别|Git新手教程


Part of the git[1] suite

Getting Started with Git SVN

  • Getting Started with Git SVN
  • Introduction
  • Caveats – Local merges – Handling empty folders properly – Cloning really big SVN repositories – About commits and SHA1
  • Troubleshooting
  • References


git svn

is a git command that allows using git to interact with Subversion repositories.

git svn

is part of git, meaning that is NOT a plugin but actually bundled with your git installation.
SourceTree also happens to support this command so you can use it with your usual workflow.

You need to use the command

git svn

without the hyphen ‘-‘.

Disclaimer This guide was written circa 2015, when working on a project where it was required to use SVN. As back in the day I was more proficient and confortable using git workflows (specifically fast and multiple local branches), in order to replicate some of those workflow with SVN I started using this command. Of course I faced some issues, so this document is just a dump of my knowledge and hopefully a helping guide in case you face the same problems as I did.

However, it is not an exhaustive guide, nor it is updated anymore, so please, if you find something wrong, please leave a messge.

I hope this guide may be helpful to you. Enjoy!

Clean the new Git repository



script included in


turns the SVN branches into local Git branches and the SVN tags into full-fledged Git tags. Note that this is a destructive operation, and you will not be able to move commits from the Git repository back into the SVN repository.

If you’re following this migration guide, this isn’t a problem, as it advocates a one-way sync from SVN to Git (the Git repository is considered read-only until after the Migrate step). However, if you’re planning on committing to the Git repository and the SVN repository during the migration process, you should not perform the following commands. This is an advanced task, as is not recommended for the typical project.

To see what can be cleaned up, run the following command in



java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git

This will output all of the changes the script wants to make, but it won’t actually make any of them. To execute these changes, you need to use the


option, like so:

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force

You should now see all of your SVN branches in the

git branch

output, along with your SVN tags in the

git tag

output. This means that you’ve successfully converted your SVN project to a Git repository.

Git Subversion (git-svn)
Git Subversion (git-svn)

SVN to Git – prepping for the migration

In Why Git?, we discussed the many ways that Git can help your team become more agile. Once you’ve decided to make the switch, your next step is to figure out how to migrate your existing development workflow to Git.

This article explains some of the biggest changes you’ll encounter while transitioning your team from SVN to Git. The most important thing to remember during the migration process is that Git is not SVN. To realize the full potential of Git, try your best to open up to new ways of thinking about version control.

Inspect the new Git repository


git svn clone

has finished (this might take a while), you’ll find a new directory called




. This is the converted Git repository. You should be able to switch into


and run any of the standard Git commands to explore your project.

Branches and tags are not imported into the new Git repository as you might expect. You won’t find any of your SVN branches in the

git branch

output, nor will you find any of your SVN tags in the

git tag

output. But, if you run

git branch -r

, you’ll find all of the branches and tags from your SVN repository. The

git svn clone

command imports your SVN branches as remote branches and imports your SVN tags as remote branches prefixed with



This behavior makes certain two-way synchronization procedures easier, but it can be very confusing when trying to make a one-way migration Git. That’s why our next step will be to convert these remote branches to local branches and actual Git tags.

Git MERGE vs REBASE: Everything You Need to Know
Git MERGE vs REBASE: Everything You Need to Know

MacOS & Perl – Can’t locate SVN/ in @INC

git svn

command is implemented as a Perl script. In newer versions of MacOS, system installed Perl do not include the


module, so you have to either:

  • Install the


    module manually at the system level with sudo. Here you have instructions to install a Perl module in MacOS
  • Install a homebrew version of Perl (which includes that module) and modify the git-svn script (located at


    ) so the scripts uses this version of Perl instead of the included with the OS. Here are instructions on how to do it

Also, remember that Subversion must also be installed on the system.

SVN Ignores

With git-svn, the information about ignored files will be managed on the SVN remote. You can fetch this information from the SVN remote repository and add them to your local ignores.

In Tower, right-click on the remote and select “Add SVN Ignores to Exclude File Patterns”. After the ignore patterns have been fetched from the SVN remote, they will be added to your .git/info/excludes file.

Git vs SVN: Pros and Cons

To help you understand how these two version control solutions match up, this section walks you through the pros and cons of each.

Git Pros and Cons

Git’s pros are the following:

  • Operates locally. Contributors work on clones of the main repository, which they can continue to work on offline, without a network connection to the main repository. Contributors only need to connect when changes are ready to be pushed. This also helps limit network traffic to the main repository.

  • Avoids having a single point of failure. The repository is distributed in local copies, so there is less to worry about if a failure occurs on the main repository. The main repository can be restored from one of the local copies.

  • Handles merging from multiple contributors effectively. Contributors all work independently on their copies of the main repository. Git then provides a robust system for reconciling and merging each contributor’s changes. Staging is part of this, allowing contributors to focus on particular features without affecting others.

Git’s cons are the following:

  • Has a higher learning curve. Using Git to collaborate on a project requires that you make your changes locally, stage those changes, and merge the changes back into the main branch. This process can get complicated, especially for non-technical users.

  • Lacks granular access control. Git supports applying limits on a contributor’s ability to create branches and merge changes on the main repository. However, you cannot restrict access to specific parts of the repository. Anyone with access to the repository has access to everything in the repository, with local repositories being clones of the entire codebase.

  • Does not effectively handle storing large binary files. Git cannot compress these files effectively, meaning that the repository size can grow exponentially with each change to a large binary file.

SVN Pros and Cons

SVN’s pros are the following:

  • Takes an easier approach. The path between creating a new feature branch and merging it into the trunk is relatively short and intuitive to grasp. This makes SVN a tool that requires less training when getting started and can be effectively taken up by non-technical contributors.

  • Facilitates a top-down approach. Since everything is centralized in an SVN repository, there is a single instance of the entire repository. This allows for granular repository access control. Each contributor’s access can be limited to particular directories and files. SVN is a good choice when you need to manage security hierarchies within a repository.

  • Efficiently stores large binary files. Teams that need to store binary files, especially when those binary files change frequently, can do so without worrying about exponential storage increases with each change. While this is not a concern for every team, this feature can be a significant boon for some workflows and version control use cases.

SVN’s cons are the following:

  • Provides limited offline capabilities. Everything operates on a centralized repository using a client-server approach. When contributors are offline and unable to access the server, they essentially lose the ability to contribute. This also entails a higher level of traffic to the main repository’s server, since contributors have to access it constantly.

  • The centralized repository server can be a single point of failure. Since contributors do not make local copies of the entire repository, unless a backup copy is made, there is only one instance of the entire repository. If an issue occurs with the instance, such as data corruption, it can have dire repercussions on a software development project.

Advantages of Git Over SVN

The ability to work locally and offline is one major advantage to Git. SVN requires contributors to be connected to the main repository server, which essentially eliminates working offline.

Git also outperforms SVN when it comes to merging and conflict resolution. Git has been designed for an open-source setting where numerous contributors may be working on the same parts of a codebase. To allow for this type of collaboration, Git has built up a robust system for resolving merge conflicts that makes the process smoother, and more manageable.

Git’s distributed model of version control helps mitigate the potential for loss of the main repository. Since contributors clone the main repository, the risk of completely losing your main repository is greatly reduced. On the other hand, SVN’s centralized model of version control creates the potential for a single point of failure should anything happen to the main repository.

Advantages of SVN Over Git

SVN’s centralized repository model makes it easier to manage contributions and contributors. Git does not support codebase access restrictions — a contributor who has access to the repository has access to the entire repository. SVN, by contrast, provides granular control, allowing for limits on particular contributors down to the directory, and file levels.

SVN also makes contributing easier. Git has robust conflict handling, but its system can often be daunting for newcomers. SVN’s system is more approachable, because the path between creating a new feature and merging it into the trunk is shorter and simpler.

SVN wins out on some performance considerations. It handles network traffic exceptionally well. So, while contributors may have to be connected to the server to complete work, the network load for this is managed efficiently. Also, SVN compresses and stores large binaries quite efficiently. If your project includes large binary files, you might consider using SVN.

Are There Drawbacks When Doing Version Control with SVN?

SVN is a popular version control system. But is Subversion software the right choice for your team? Here are some challenges you’ll face when doing version control with SVN.

The Disadvantages of Working with Subversion

Subversion (SVN) Has a Complex Branching Model

The most common complaint about SVN is its tedious branching model. Branches allow you to work on multiple versions of your code simultaneously.

What is SVN’s branching model? In Subversion, branches are created as directories inside the server. Many developers dislike this directory structure. But the challenges don’t stop there.

In SVN, users identify branches by naming conventions. If changes are discovered that need to be applied across several development branches, the task to merge back can be complex and error prone.

The weak branching capability is among the root causes of the widely discussed merging challenges people have with Subversion and adds complexity to implementing a branching strategy in SVN.

Subversion (SVN) Has Limited Performance and Scalability

SVN is a central single-server system which limits performance and scalability.

As a result, SVN struggles with large repositories and file sizes. It is difficult to find concrete benchmark data for the limitations of Subversion. This makes planning and scaling an even greater challenge.

Subversion (SVN) Only Has Basic Merging Capabilities

Merging is the other big problem that developers often complain about with SVN. If you’re working with a history where a set of changes are made and committed, then another change is made (i.e., linear) and committed, the merge will be easy.

Things get complicated when you have two or more developers working on the same code base and you need to merge. In this case, Subversion fails, and the developers need to resolve the conflicts manually, which wastes hours of their time.

So, Why Subversion?

SVN comes with many challenges. So why is Subversion still used? There are 2 big reasons: cost and inertia.

  • Cost: SVN is open source, which means it’s “free.” Learn more about the real cost of SVN.
  • Inertia: Once a large code base is built up, it’s can be daunting to switch version control systems. SVN has been around since 2004, and the organizations who adopted it could have millions of lines of code in it.

Outgrown Subversion?

Users have begun to realize that SVN can no longer support the demands that are placed on a versioning system in today’s accelerated development environment and are looking for an alternative that solves those problems.

If you’ve outgrown Subversion, Perforce has enterprise version control software that lets you scale without limits. That version control is Helix Core.

Migrating from Subversion to Helix Core can be simple and seamless with the right plan and strategy in place.

📘 Related Resource: SVN Migration Toolkit

Helix Core – Version Control

Perforce Helix Core is centralized version control that has all the benefits of Subversion without the challenges.

You’ll get:

  • A centralized server (which can also be used in a distributed mode) that creates a single source of truth.
  • Easy-to-use tools such as P4EXP (an equivalent tool to TortoiseSVN).
  • Efficient and powerful branching using Streams.
  • The ease of committing changes, even across multiple repositories.
  • Automatic resolution of most merge conflicts.

Helix Core is a compelling solution for those looking to regain productivity and resources lost to SVN. Helix Core will deliver satisfaction to your organization both from a technology perspective and from the standpoint of support and services.

It’s designed for collaboration, scalability, and flexibility. Try the full version of Helix Core. It’s free for up to 5 users.

GitSVN commands

Git has become the dominant version control system in recent years, especially in the open-source community, while SVN has declined. If you’re switching from SVN to Git here is a quick reference comparing common commands.

Comparison table of Git-Subversion commands

Command Operation Subversion
git clone Copy a repository svn checkout
git commit Record changes to file history svn commit
git show View commit details svn cat
git status View status svn status
git diff View differences svn diff
git log View log svn log
git add Add svn add
git mv Move svn mv
git rm Delete svn rm
git reset Cancel change svn revert1
git branch Create a branch svn copy2
git checkout Switch branches svn switch
git merge Merge svn merge
git tag Create a tag svn copy2
git pull Update svn update
git fetch Update svn update
git push Changes reflected on the remote svn commit3
.gitignore Ignore file list .svnignore
  1. Revert in SVN cancels a change, but Revert in Git negates a change.
  2. Branch and tag are the same in SVN but different in Git.
  3. SVN does not have the concept of a local repository vs. remote repository; accordingly, a commit is directly reflected in the remote.


The differences between SVN and Git that matter

Technology platforms evolve over years, or even decades, within large, mature organizations. This means that the underlying codebase also evolves, since numerous developers and application managers will invariably manipulate that code with every modification and technology addition. The need to preserve the resiliency of code is dire, which has effectively triggered an explosion of code versioning and management tools.

Two tools in particular — Git and Apache Subversion (SVN) — have become top names in the code versioning tool market. But while they chase similar goals, there are some key differences in the way they handle versioning and the places they are best suited to do their job.

To highlight these differences, let’s take a look at some of the basics concerning Git and SVN, including their major benefits and most notable drawbacks.

Why Is Git More Popular Than SVN?

Git is also more popular. SVN’s popularity is waning. And many teams are looking to make a switch. That’s because Git is better than SVN at branching — and it can be better than SVN for access control and auditability, based on your needs.

There are a couple of reasons for making the switch from SVN. It isn’t a great tool for automation and DevOps. And that it no longer has a vibrant community supporting it.

You could migrate from SVN to Git (and use a Git SVN pull command to pull in commits). Git seems like a no-brainer when looking for a more modern and supported system to replace SVN. Especially since it is also open source: you won’t have to budget for something that you aren’t paying for today.

However, if you are working with large files, have large global teams, security concerns, or other “at scale” challenges, Git may create more problems than it solves.

Back to top


git svn is a simple conduit for changesets between Subversion and Git. It provides a bidirectional flow of changes between a Subversion and a Git repository.

git svn can track a standard Subversion repository, following the common “trunk/branches/tags” layout, with the –stdlayout option. It can also follow branches and tags in any layout with the -T/-t/-b options (see options to init below, and also the clone command).

Once tracking a Subversion repository (with any of the above methods), the Git repository can be updated from Subversion by the fetch command and Subversion updated from Git by the dcommit command.

What Is the Difference Between Git and SVN?

The biggest difference between Git vs Subversion (SVN) is that Git version control is distributed while SVN is centralized. There are also key differences in repositories, branching, and more.

If you’re considering switching from SVN to Git, you’ll want to take these into account.

Back to top



Mapping between Subversion revision numbers and Git commit names. In a repository where the noMetadata option is not set, this can be rebuilt from the git-svn-id: lines that are at the end of every commit (see the svn.noMetadata section above for details).

git svn fetch and git svn rebase automatically update the rev_map if it is missing or not up to date. git svn reset automatically rewinds it.

Synchronizing with an SVN Remote

Synchronizing with SVN remotes pretty much works the same as with a Git remote. You can fetch, pull and push changes.

The only twist is that each local branch is tied to the SVN remote branch it was derived from. For example, if your local branch master was created from the SVN remote branch trunk, they will be tied forever by the git-svn-id line that every local git-svn commit carries in its message. This git-svn-id line contains an SVN repository identifier and the full SVN URL along with the SVN revision it corresponds to. It is probably a good idea to set up Git branch tracking between your local Git branch and your SVN branch so you will receive information about commits ahead and behind.

If you create new commits, they will be missing the git-svn-id. This is because they are not yet associated with an SVN revision as they have not yet been pushed. Once you successfully push them to the SVN repository, each commit you have made will be rewritten locally with the git-svn-id.

Another thing worth noting is that git-svn will always rebase your local branch with new revisions from the SVN repository (e.g. pull –rebase). This is done to preserve SVN’s linear revision history, which rebase is all about. If you are not familiar with Git’s rebase, it may be a good time to dive into this topic first.

Just like in Git, it is a good idea to check for changes and pull them in before pushing to an SVN remote. git-svn will automatically update your current HEAD with the latest revisions if you have not already done so. However, if there are conflicts while rebasing, push will be aborted and you will have to resolve the conflicts and push again–so it is probably more convenient to pull first.

A Better Solution: Perforce

Perforce version control — Helix Core — has better access control and auditability than both Git and SVN.

It delivers better architecture performance, binary file management, and usability than SVN. And it offers a better way to branch and merge (Perforce Streams) than Git. Plus, if you have a team working in Git, you can add Helix4Git to bring their Git code into your build pipeline.

Helix4Git is a high-performance Git server inside Helix Core that enables developers to use their preferred Git tools (GitLab, GitHub, Bitbucket), while also getting all of the benefits of Helix Core. This enables teams to streamline their build process by letting them mirror, cache, and replicate their Git repositories on a global — on average, teams can achieve 40-80 percent faster builds that also take up 18 percent less storage.

See for yourself why Helix Core is the best version control for your team. You can get started for free for up to 5 users.

Lệnh Git so với lệnh SVN

Git đã trở thành hệ thống kiểm soát phiên bản chiếm ưu thế trong những năm gần đây, đặc biệt là trong cộng đồng nguồn mở, trong khi SVN đã suy tàn. Nếu bạn chuyển từ SVN sang Git, đây là tài liệu tham khảo nhanh so sánh các lệnh phổ biến.

Bảng so sánh các lệnh Git-Subversion

Lệnh Thao tác Subversion
git clone Sao chép một kho lưu trữ svn checkout
git commit Ghi lại các thay đổi vào lịch sử tệp svn commit
git show Xem chi tiết cam kết svn cat
git status Xem trạng thái svn status
git diff Xem khác biệt svn diff
git log Xem nhật kí svn log
git add Thêm svn add
git mv Di chuyển svn mv
git rm Xóa svn rm
git reset Hủy thay đổi svn revert1
git branch Tạo một nhánh svn copy2
git checkout Chuyển đổi nhánh svn switch
git merge Hợp nhất svn merge
git tag Tạo một thẻ svn copy2
git pull Cập nhật svn update
git fetch Cập nhật svn update
git push Những thay đổi được phản ánh trên kho lưu trữ từ xa svn commit3
.gitignore Bỏ qua danh sách tệp .svnignore
  1. Khôi phục ở SVN hủy bỏ thay đổi, nhưng Khôi phục trong Git phủ nhận thay đổi.
  2. Nhánh và thẻ giống nhau trong SVN nhưng khác nhau trong Git.
  3. SVN không có khái niệm về kho lưu trữ cục bộ so với kho lưu trữ từ xa; theo đó, một cam kết được phản ánh trực tiếp trong kho lưu trữ từ xa.

Keywords searched by users: what is git svn

Switching From Subversion To Git | Learn Git Ebook (Cli Edition)
Switching From Subversion To Git | Learn Git Ebook (Cli Edition)
What Are The Pros And Cons Of Using Git Rather Than Svn As Revision Control  System Distributed? - Quora
What Are The Pros And Cons Of Using Git Rather Than Svn As Revision Control System Distributed? – Quora
Learning Git (For Svn Users) – Giselle Reis
Learning Git (For Svn Users) – Giselle Reis
Migrating From Svn To Git With Git-Externals
Migrating From Svn To Git With Git-Externals
Moving Our Codebase From Svn To Git — Pramata Engineering
Moving Our Codebase From Svn To Git — Pramata Engineering
▷ Git Vs Svn | Which One Is Better? In 2024 | Mindmajix
▷ Git Vs Svn | Which One Is Better? In 2024 | Mindmajix
What Are The Main Differences Between Git And Svn? - Youtube
What Are The Main Differences Between Git And Svn? – Youtube
Difference Between Git And Subversion | Difference Between
Difference Between Git And Subversion | Difference Between
Can Different Git-Svn Clones Of The Same Svn Repository Expect To Be Able  To Share Changes Then Git Svn Dcommit? - Stack Overflow
Can Different Git-Svn Clones Of The Same Svn Repository Expect To Be Able To Share Changes Then Git Svn Dcommit? – Stack Overflow
Git And Subversion Collaboration | There And Back Again
Git And Subversion Collaboration | There And Back Again
Git Vs Svn (Subversion) | What Are The Differences?
Git Vs Svn (Subversion) | What Are The Differences?
Difference Between Github And Svn | Difference Between
Difference Between Github And Svn | Difference Between
Git And Subversion Collaboration | There And Back Again
Git And Subversion Collaboration | There And Back Again
Git From Svn | Ppt
Git From Svn | Ppt
Svn - Git Migration Complete Guide
Svn – Git Migration Complete Guide

See more here:

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *