<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article lang="en" id="git-svn(1)">
<articleinfo>
    <title>git-svn(1)</title>
        <indexterm>
                <primary>git-svn(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-svn - Bidirectional operation between a single Subversion branch and git</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git svn</emphasis> &lt;command&gt; [options] [arguments]</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara><emphasis>git-svn</emphasis> is a simple conduit for changesets between Subversion and git.
It provides a bidirectional flow of changes between a Subversion and a git
repository.</simpara>
<simpara><emphasis>git-svn</emphasis> can track a single Subversion branch simply by using a
URL to the branch, follow branches laid out in the Subversion recommended
method (trunk, branches, tags directories) with the --stdlayout option, or
follow branches in any layout with the -T/-t/-b options (see options to
<emphasis>init</emphasis> below, and also the <emphasis>clone</emphasis> command).</simpara>
<simpara>Once tracking a Subversion branch (with any of the above methods), the git
repository can be updated from Subversion by the <emphasis>fetch</emphasis> command and
Subversion updated from git by the <emphasis>dcommit</emphasis> command.</simpara>
</simplesect>
<simplesect id="_commands">
<title>COMMANDS</title>
<variablelist>
<varlistentry>
<term>
<emphasis>init</emphasis>
</term>
<listitem>
<simpara>
        Initializes an empty git repository with additional
        metadata directories for <emphasis>git-svn</emphasis>.  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.
</simpara>
<variablelist>
<varlistentry>
<term>
-T&lt;trunk_subdir&gt;
</term>
<term>
--trunk=&lt;trunk_subdir&gt;
</term>
<term>
-t&lt;tags_subdir&gt;
</term>
<term>
--tags=&lt;tags_subdir&gt;
</term>
<term>
-b&lt;branches_subdir&gt;
</term>
<term>
--branches=&lt;branches_subdir&gt;
</term>
<term>
-s
</term>
<term>
--stdlayout
</term>
<listitem>
<simpara>
        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=https://foo.org/project/tags). 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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-metadata
</term>
<listitem>
<simpara>
        Set the <emphasis>noMetadata</emphasis> option in the [svn-remote] config.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--use-svm-props
</term>
<listitem>
<simpara>
        Set the <emphasis>useSvmProps</emphasis> option in the [svn-remote] config.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--use-svnsync-props
</term>
<listitem>
<simpara>
        Set the <emphasis>useSvnsyncProps</emphasis> option in the [svn-remote] config.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--rewrite-root=&lt;URL&gt;
</term>
<listitem>
<simpara>
        Set the <emphasis>rewriteRoot</emphasis> option in the [svn-remote] config.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--use-log-author
</term>
<listitem>
<simpara>
        When retrieving svn commits into git (as part of fetch, rebase, or
        dcommit operations), look for the first From: or Signed-off-by: line
        in the log message and use that as the author string.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--add-author-from
</term>
<listitem>
<simpara>
        When committing to svn from git (as part of commit or dcommit
        operations), if the existing log message doesn&#8217;t already have a
        From: or Signed-off-by: line, append a From: line based on the
        git commit&#8217;s author string.  If you use this, then --use-log-author
        will retrieve a valid author string for all commits.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--username=&lt;USER&gt;
</term>
<listitem>
<simpara>
        For transports that SVN handles authentication for (http,
        https, and plain svn), specify the username.  For other
        transports (eg svn+ssh://), you must include the username in
        the URL, eg svn+ssh://<ulink url="mailto:foo@svn.bar.com">foo@svn.bar.com</ulink>/project
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--prefix=&lt;prefix&gt;
</term>
<listitem>
<simpara>
        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 is useful if you wish to track multiple
        projects that share a common repository.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>fetch</emphasis>
</term>
<listitem>
<simpara>
        Fetch unfetched revisions from the Subversion remote we are
        tracking.  The name of the [svn-remote "&#8230;"] section in the
        .git/config file may be specified as an optional command-line
        argument.
</simpara>
<variablelist>
<varlistentry>
<term>
--localtime
</term>
<listitem>
<simpara>
        Store Git commit times in the local timezone instead of UTC.  This
        makes <emphasis>git-log</emphasis> (even without --date=local) show the same times
        that <literal>svn log</literal> would in the local timezone.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
<simpara>This doesn&#8217;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&#8217;s local Git
repository, either don&#8217;t use this option or you should both use it in
the same local timezone.</simpara>
<variablelist>
<varlistentry>
<term>
--ignore-paths=&lt;regex&gt;
</term>
<listitem>
<simpara>
        This allows one to specify Perl regular expression that will
        cause skipping of all matching paths from checkout from SVN.
        Examples:
</simpara>
<literallayout class="monospaced">--ignore-paths="^doc" - skip "doc*" directory for every fetch.</literallayout>
<literallayout class="monospaced">--ignore-paths="^[^/]+/(?:branches|tags)" - skip "branches"
    and "tags" of first level directories.</literallayout>
<literallayout class="monospaced">Regular expression is not persistent, you should specify
it every time when fetching.</literallayout>
<variablelist>
<varlistentry>
<term>
<emphasis>clone</emphasis>
</term>
<listitem>
<simpara>
        Runs <emphasis>init</emphasis> and <emphasis>fetch</emphasis>.  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
        <emphasis>init</emphasis> and <emphasis>fetch</emphasis> commands accept; with the exception of
        <emphasis>--fetch-all</emphasis>.   After a repository is cloned, the <emphasis>fetch</emphasis>
        command will be able to update revisions without affecting
        the working tree; and the <emphasis>rebase</emphasis> command will be able
        to update the working tree with the latest changes.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>rebase</emphasis>
</term>
<listitem>
<simpara>
        This fetches revisions from the SVN parent of the current HEAD
        and rebases the current (uncommitted to SVN) work against it.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
<simpara>This works similarly to <literal>svn update</literal> or <emphasis>git-pull</emphasis> except that
it preserves linear history with <emphasis>git-rebase</emphasis> instead of
<emphasis>git-merge</emphasis> for ease of dcommitting with <emphasis>git-svn</emphasis>.</simpara>
<simpara>This accepts all options that <emphasis>git-svn fetch</emphasis> and <emphasis>git-rebase</emphasis>
accept.  However, <emphasis>--fetch-all</emphasis> only fetches from the current
[svn-remote], and not all [svn-remote] definitions.</simpara>
<simpara>Like <emphasis>git-rebase</emphasis>; this requires that the working tree be clean
and have no uncommitted changes.</simpara>
<variablelist>
<varlistentry>
<term>
-l
</term>
<term>
--local
</term>
<listitem>
<simpara>
        Do not fetch remotely; only run <emphasis>git-rebase</emphasis> against the
        last fetched commit from the upstream SVN.
</simpara>
<variablelist>
<varlistentry>
<term>
<emphasis>dcommit</emphasis>
</term>
<listitem>
<simpara>
        Commit each diff from a specified head 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.
        It is recommended that you run <emphasis>git-svn</emphasis> fetch and rebase (not
        pull or merge) your commits against the latest changes in the
        SVN repository.
        An optional command-line argument may be specified as an
        alternative to HEAD.
        This is advantageous over <emphasis>set-tree</emphasis> (below) because it produces
        cleaner, more linear history.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-rebase
</term>
<listitem>
<simpara>
        After committing, do not rebase or reset.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--commit-url &lt;URL&gt;
</term>
<listitem>
<simpara>
        Commit to this SVN URL (the full path).  This is intended to
        allow existing git-svn repositories created with one transport
        method (e.g. <literal>svn://</literal> or <literal>http://</literal> for anonymous read) to be
        reused if a user is later given access to an alternate transport
        method (e.g. <literal>svn+ssh://</literal> or <literal>https://</literal>) for commit.
</simpara>
<literallayout class="monospaced">Using this option for any other purpose (don't ask)
is very strongly discouraged.</literallayout>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>
<emphasis>branch</emphasis>
</term>
<listitem>
<simpara>
        Create a branch in the SVN repository.
</simpara>
<variablelist>
<varlistentry>
<term>
-m
</term>
<term>
--message
</term>
<listitem>
<simpara>
        Allows to specify the commit message.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-t
</term>
<term>
--tag
</term>
<listitem>
<simpara>
        Create a tag by using the tags_subdir instead of the branches_subdir
        specified during git svn init.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>tag</emphasis>
</term>
<listitem>
<simpara>
        Create a tag in the SVN repository. This is a shorthand for
        <emphasis>branch -t</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>log</emphasis>
</term>
<listitem>
<simpara>
        This should make it easy to look up svn log messages when svn
        users refer to -r/--revision numbers.
</simpara>
<simpara>The following features from &#8216;svn log&#8217; are supported:</simpara>
<variablelist>
<varlistentry>
<term>
--revision=&lt;n&gt;[:&lt;n&gt;]
</term>
<listitem>
<simpara>
        is supported, non-numeric args are not:
        HEAD, NEXT, BASE, PREV, etc &#8230;
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-v/--verbose
</term>
<listitem>
<simpara>
        it&#8217;s not completely compatible with the --verbose
        output in svn log, but reasonably close.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--limit=&lt;n&gt;
</term>
<listitem>
<simpara>
        is NOT the same as --max-count, doesn&#8217;t count
        merged/excluded commits
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--incremental
</term>
<listitem>
<simpara>
        supported
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>New features:</simpara>
<variablelist>
<varlistentry>
<term>
--show-commit
</term>
<listitem>
<simpara>
        shows the git commit sha1, as well
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--oneline
</term>
<listitem>
<simpara>
        our version of --pretty=oneline
</simpara>
</listitem>
</varlistentry>
</variablelist>
<note><simpara>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.</simpara></note>
<simpara>Any other arguments are passed directly to <emphasis>git-log</emphasis></simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>blame</emphasis>
</term>
<listitem>
<simpara>
       Show what revision and author last modified each line of a file. The
       output of this mode is format-compatible with the output of
       &#8216;svn blame&#8217; by default. Like the SVN blame command,
       local uncommitted changes in the working copy are ignored;
       the version of the file in the HEAD revision is annotated. Unknown
       arguments are passed directly to <emphasis>git-blame</emphasis>.
</simpara>
<variablelist>
<varlistentry>
<term>
--git-format
</term>
<listitem>
<simpara>
        Produce output in the same format as <emphasis>git-blame</emphasis>, but with
        SVN revision numbers instead of git commit hashes. In this mode,
        changes that haven&#8217;t been committed to SVN (including local
        working-copy edits) are shown as revision 0.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>
<emphasis>find-rev</emphasis>
</term>
<listitem>
<simpara>
        When given an SVN revision number of the form <emphasis>rN</emphasis>, 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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>set-tree</emphasis>
</term>
<listitem>
<simpara>
        You should consider using <emphasis>dcommit</emphasis> 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 <emphasis>git-svn</emphasis> functions.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>create-ignore</emphasis>
</term>
<listitem>
<simpara>
        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.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>show-ignore</emphasis>
</term>
<listitem>
<simpara>
        Recursively finds and lists the svn:ignore property on
        directories.  The output is suitable for appending to
        the $GIT_DIR/info/exclude file.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>commit-diff</emphasis>
</term>
<listitem>
<simpara>
        Commits the diff of two tree-ish arguments from the
        command-line.  This command does not rely on being inside an <literal>git-svn
        init</literal>-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 <emphasis>git-svn</emphasis>-aware
        repository (that has been <literal>init</literal>-ed with <emphasis>git-svn</emphasis>).
        The -r&lt;revision&gt; option is required for this.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>info</emphasis>
</term>
<listitem>
<simpara>
        Shows information about a file or directory similar to what
        &#8216;svn info&#8217; provides.  Does not currently support a -r/--revision
        argument.  Use the --url option to output only the value of the
        <emphasis>URL:</emphasis> field.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>proplist</emphasis>
</term>
<listitem>
<simpara>
        Lists the properties stored in the Subversion repository about a
        given file or directory.  Use -r/--revision to refer to a specific
        Subversion revision.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>propget</emphasis>
</term>
<listitem>
<simpara>
        Gets the Subversion property given as the first argument, for a
        file.  A specific revision can be specified with -r/--revision.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<emphasis>show-externals</emphasis>
</term>
<listitem>
<simpara>
        Shows the Subversion externals.  Use -r/--revision to specify a
        specific revision.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--shared[={false|true|umask|group|all|world|everybody}]
</term>
<term>
--template=&lt;template_directory&gt;
</term>
<listitem>
<simpara>
        Only used with the <emphasis>init</emphasis> command.
        These are passed directly to <emphasis>git-init</emphasis>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-r &lt;ARG&gt;
</term>
<term>
--revision &lt;ARG&gt;
</term>
<listitem>
<simpara>
Used with the <emphasis>fetch</emphasis> command.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>This allows revision ranges for partial/cauterized history
to be supported.  $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
$NUMBER:HEAD, and BASE:$NUMBER are all supported.</simpara>
<simpara>This can allow you to make partial mirrors when running fetch;
but is generally not recommended because history will be skipped
and lost.</simpara>
<variablelist>
<varlistentry>
<term>
-
</term>
<term>
--stdin
</term>
<listitem>
<simpara>
Only used with the <emphasis>set-tree</emphasis> command.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Read a list of commits from stdin and commit them in reverse
order.  Only the leading sha1 is read from each line, so
<emphasis>git-rev-list --pretty=oneline</emphasis> output can be used.</simpara>
<variablelist>
<varlistentry>
<term>
--rmdir
</term>
<listitem>
<simpara>
Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>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.</simpara>
<simpara>config key: svn.rmdir</simpara>
<variablelist>
<varlistentry>
<term>
-e
</term>
<term>
--edit
</term>
<listitem>
<simpara>
Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>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.</simpara>
<simpara>config key: svn.edit</simpara>
<variablelist>
<varlistentry>
<term>
-l&lt;num&gt;
</term>
<term>
--find-copies-harder
</term>
<listitem>
<simpara>
Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>They are both passed directly to <emphasis>git-diff-tree</emphasis>; see
<xref linkend="git-diff-tree(1)"/> for more information.</simpara>
<blockquote>
<literallayout>config key: svn.l
config key: svn.findcopiesharder</literallayout>
</blockquote>
<variablelist>
<varlistentry>
<term>
-A&lt;filename&gt;
</term>
<term>
--authors-file=&lt;filename&gt;
</term>
<listitem>
<simpara>
Syntax is compatible with the file used by <emphasis>git-cvsimport</emphasis>:
</simpara>
</listitem>
</varlistentry>
</variablelist>
<literallayout>        loginname = Joe User &lt;user@example.com&gt;</literallayout>
<simpara>If this option is specified and <emphasis>git-svn</emphasis> encounters an SVN
committer name that does not exist in the authors-file, <emphasis>git-svn</emphasis>
will abort operation. The user will then have to add the
appropriate entry.  Re-running the previous <emphasis>git-svn</emphasis> command
after the authors-file is modified should continue operation.</simpara>
<simpara>config key: svn.authorsfile</simpara>
<variablelist>
<varlistentry>
<term>
-q
</term>
<term>
--quiet
</term>
<listitem>
<simpara>
        Make <emphasis>git-svn</emphasis> less verbose.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--repack[=&lt;n&gt;]
</term>
<term>
--repack-flags=&lt;flags&gt;
</term>
<listitem>
<simpara>
These should help keep disk usage sane for large fetches
with many revisions.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>--repack takes an optional argument for the number of revisions
to fetch before repacking.  This defaults to repacking every
1000 commits fetched if no argument is specified.</simpara>
<simpara>--repack-flags are passed directly to <emphasis>git-repack</emphasis>.</simpara>
<blockquote>
<literallayout>config key: svn.repack
config key: svn.repackflags</literallayout>
</blockquote>
<variablelist>
<varlistentry>
<term>
-m
</term>
<term>
--merge
</term>
<term>
-s&lt;strategy&gt;
</term>
<term>
--strategy=&lt;strategy&gt;
</term>
<listitem>
<simpara>
These are only used with the <emphasis>dcommit</emphasis> and <emphasis>rebase</emphasis> commands.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Passed directly to <emphasis>git-rebase</emphasis> when using <emphasis>dcommit</emphasis> if a
<emphasis>git-reset</emphasis> cannot be used (see <emphasis>dcommit</emphasis>).</simpara>
<variablelist>
<varlistentry>
<term>
-n
</term>
<term>
--dry-run
</term>
<listitem>
<simpara>
This can be used with the <emphasis>dcommit</emphasis>, <emphasis>rebase</emphasis>, <emphasis>branch</emphasis> and <emphasis>tag</emphasis>
commands.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>For <emphasis>dcommit</emphasis>, print out the series of git arguments that would show
which diffs would be committed to SVN.</simpara>
<simpara>For <emphasis>rebase</emphasis>, 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.</simpara>
<simpara>For <emphasis>branch</emphasis> and <emphasis>tag</emphasis>, display the urls that will be used for copying when
creating the branch or tag.</simpara>
</simplesect>
<simplesect id="_advanced_options">
<title>ADVANCED OPTIONS</title>
<variablelist>
<varlistentry>
<term>
-i&lt;GIT_SVN_ID&gt;
</term>
<term>
--id &lt;GIT_SVN_ID&gt;
</term>
<listitem>
<simpara>
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 <emphasis>log</emphasis> and <emphasis>dcommit</emphasis> commands
no longer require this switch as an argument.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
-R&lt;remote name&gt;
</term>
<term>
--svn-remote &lt;remote name&gt;
</term>
<listitem>
<simpara>
        Specify the [svn-remote "&lt;remote name&gt;"] section to use,
        this allows SVN multiple repositories to be tracked.
        Default: "svn"
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--follow-parent
</term>
<listitem>
<simpara>
        This is especially helpful when we&#8217;re tracking a directory
        that has been moved around within the repository, or if we
        started tracking a branch and never tracked the trunk it was
        descended from. This feature is enabled by default, use
        --no-follow-parent to disable it.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>config key: svn.followparent</simpara>
</simplesect>
<simplesect id="_config_file_only_options">
<title>CONFIG FILE-ONLY OPTIONS</title>
<variablelist>
<varlistentry>
<term>
svn.noMetadata
</term>
<term>
svn-remote.&lt;name&gt;.noMetadata
</term>
<listitem>
<simpara>
This gets rid of the <emphasis>git-svn-id:</emphasis> lines at the end of every commit.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>If you lose your .git/svn/git-svn/.rev_db file, <emphasis>git-svn</emphasis> will not
be able to rebuild it and you won&#8217;t be able to fetch again,
either.  This is fine for one-shot imports.</simpara>
<simpara>The <emphasis>git-svn log</emphasis> command will not work on repositories using
this, either.  Using this conflicts with the <emphasis>useSvmProps</emphasis>
option for (hopefully) obvious reasons.</simpara>
<variablelist>
<varlistentry>
<term>
svn.useSvmProps
</term>
<term>
svn-remote.&lt;name&gt;.useSvmProps
</term>
<listitem>
<simpara>
This allows <emphasis>git-svn</emphasis> to re-map repository URLs and UUIDs from
mirrors created using SVN::Mirror (or svk) for metadata.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>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.</simpara>
<variablelist>
<varlistentry>
<term>
svn.useSvnsyncProps
</term>
<term>
svn-remote.&lt;name&gt;.useSvnsyncprops
</term>
<listitem>
<simpara>
        Similar to the useSvmProps option; this is for users
        of the svnsync(1) command distributed with SVN 1.4.x and
        later.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
svn-remote.&lt;name&gt;.rewriteRoot
</term>
<listitem>
<simpara>
        This allows users to create repositories from alternate
        URLs.  For example, an administrator could run <emphasis>git-svn</emphasis> 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.
</simpara>
</listitem>
</varlistentry>
</variablelist>
<simpara>Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
options all affect the metadata generated and used by <emphasis>git-svn</emphasis>; they
<emphasis role="strong">must</emphasis> be set in the configuration file before any history is imported
and these settings should never be changed once they are set.</simpara>
<simpara>Additionally, only one of these four options can be used per-svn-remote
section because they affect the <emphasis>git-svn-id:</emphasis> metadata line.</simpara>
</simplesect>
<simplesect id="_basic_examples">
<title>BASIC EXAMPLES</title>
<simpara>Tracking and contributing to the trunk of a Subversion-managed project:</simpara>
<literallayout># Clone a repo (like git clone):
        git svn clone http://svn.example.com/project/trunk
# 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 &gt;&gt; .git/info/exclude</literallayout>
<simpara>Tracking and contributing to an entire Subversion-managed project
(complete with a trunk, tags and branches):</simpara>
<literallayout># Clone a repo (like git clone):
        git svn clone http://svn.example.com/project -T trunk -b branches -t tags
# 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 remotes/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.</literallayout>
<simpara>The initial <emphasis>git-svn clone</emphasis> can be quite time-consuming
(especially for large Subversion repositories). If multiple
people (or one person with multiple machines) want to use
<emphasis>git-svn</emphasis> to interact with the same Subversion repository, you can
do the initial <emphasis>git-svn clone</emphasis> to a repository on a server and
have each person clone that repository with <emphasis>git-clone</emphasis>:</simpara>
<literallayout># Do the initial import on a server
        ssh server "cd /pub &amp;&amp; git svn clone http://svn.example.com/project
# 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 --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
        git fetch
# 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 -T/-b/-t options as were used on server)
        git svn init http://svn.example.com/project
# Pull the latest changes from Subversion
        git svn rebase</literallayout>
</simplesect>
<simplesect id="_rebase_vs_pull_merge">
<title>REBASE VS. PULL/MERGE</title>
<simpara>Originally, <emphasis>git-svn</emphasis> recommended that the <emphasis>remotes/git-svn</emphasis> branch be
pulled or merged from.  This is because the author favored
<literal>git svn set-tree B</literal> to commit a single head rather than the
<literal>git svn set-tree A..B</literal> notation to commit multiple commits.</simpara>
<simpara>If you use &#8216;git svn set-tree A..B` to commit several diffs and you do
not have the latest remotes/git-svn merged into my-branch, you should
use <literal>git svn rebase</literal> to update your work branch instead of <literal>git pull</literal> or
<literal>git merge</literal>.  <literal>pull</literal>/`merge&#8217; can cause non-linear history to be flattened
when committing into SVN, which can lead to merge commits reversing
previous commits in SVN.</simpara>
</simplesect>
<simplesect id="_design_philosophy">
<title>DESIGN PHILOSOPHY</title>
<simpara>Merge tracking in Subversion is lacking and doing branched development
with Subversion can be cumbersome as a result.  While <emphasis>git-svn</emphasis> can track
copy history (including branches and tags) for repositories adopting a
standard layout, it cannot yet represent merge history that happened
inside git back upstream to SVN users.  Therefore it is advised that
users keep history as linear as possible inside git to ease
compatibility with SVN (see the CAVEATS section below).</simpara>
</simplesect>
<simplesect id="_caveats">
<title>CAVEATS</title>
<simpara>For the sake of simplicity and interoperating with a less-capable system
(SVN), it is recommended that all <emphasis>git-svn</emphasis> users clone, fetch and dcommit
directly from the SVN server, and avoid all <emphasis>git-clone</emphasis>/<emphasis>pull</emphasis>/<emphasis>merge</emphasis>/<emphasis>push</emphasis>
operations between git repositories and branches.  The recommended
method of exchanging code between git branches and users is
<emphasis>git-format-patch</emphasis> and <emphasis>git-am</emphasis>, or just 'dcommit&#8217;ing to the SVN repository.</simpara>
<simpara>Running <emphasis>git-merge</emphasis> or <emphasis>git-pull</emphasis> is NOT recommended on a branch you
plan to <emphasis>dcommit</emphasis> from.  Subversion does not represent merges in any
reasonable or useful fashion; so users using Subversion cannot see any
merges you&#8217;ve made.  Furthermore, if you merge or pull from a git branch
that is a mirror of an SVN branch, <emphasis>dcommit</emphasis> may commit to the wrong
branch.</simpara>
<simpara><emphasis>git-clone</emphasis> does not clone branches under the refs/remotes/ hierarchy or
any <emphasis>git-svn</emphasis> metadata, or config.  So repositories created and managed with
using <emphasis>git-svn</emphasis> should use <emphasis>rsync</emphasis> for cloning, if cloning is to be done
at all.</simpara>
<simpara>Since <emphasis>dcommit</emphasis> uses rebase internally, any git branches you <emphasis>git-push</emphasis> to
before <emphasis>dcommit</emphasis> on will require forcing an overwrite of the existing ref
on the remote repository.  This is generally considered bad practice,
see the <xref linkend="git-push(1)"/> documentation for details.</simpara>
<simpara>Do not use the --amend option of <xref linkend="git-commit(1)"/> on a change you&#8217;ve
already dcommitted.  It is considered bad practice to --amend commits
you&#8217;ve already pushed to a remote repository for other users, and
dcommit with SVN is analogous to that.</simpara>
</simplesect>
<simplesect id="_bugs">
<title>BUGS</title>
<simpara>We ignore all SVN properties except svn:executable.  Any unhandled
properties are logged to $GIT_DIR/svn/&lt;refname&gt;/unhandled.log</simpara>
<simpara>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&#8217;s quite difficult and time-consuming to get working for all
the possible corner cases (git doesn&#8217;t do it, either).  Committing
renamed and copied files are fully supported if they&#8217;re similar enough
for git to detect them.</simpara>
</simplesect>
<simplesect id="_configuration">
<title>CONFIGURATION</title>
<simpara><emphasis>git-svn</emphasis> stores [svn-remote] configuration information in the
repository .git/config file.  It is similar the core git
[remote] sections except <emphasis>fetch</emphasis> keys do not accept glob
arguments; but they are instead handled by the <emphasis>branches</emphasis>
and <emphasis>tags</emphasis> keys.  Since some SVN repositories are oddly
configured with multiple projects glob expansions such those
listed below are allowed:</simpara>
<literallayout>[svn-remote "project-a"]
        url = http://server.org/svn
        branches = branches/*/project-a:refs/remotes/project-a/branches/*
        tags = tags/*/project-a:refs/remotes/project-a/tags/*
        trunk = trunk/project-a:refs/remotes/project-a/trunk</literallayout>
<simpara>Keep in mind that the <emphasis><emphasis role="strong"></emphasis> (asterisk) wildcard of the local ref
(right of the <emphasis>:</emphasis>) *must</emphasis> be the farthest right path component;
however the remote wildcard may be anywhere as long as it&#8217;s own
independent path component (surrounded by <emphasis>/</emphasis> or EOL).   This
type of configuration is not automatically created by <emphasis>init</emphasis> and
should be manually entered with a text-editor or using <emphasis>git-config</emphasis>.</simpara>
</simplesect>
<simplesect id="_see_also">
<title>SEE ALSO</title>
<simpara><xref linkend="git-rebase(1)"/></simpara>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Eric Wong &lt;<ulink url="mailto:normalperson@yhbt.net">normalperson@yhbt.net</ulink>&gt;.</simpara>
</simplesect>
<simplesect id="_documentation">
<title>Documentation</title>
<simpara>Written by Eric Wong &lt;<ulink url="mailto:normalperson@yhbt.net">normalperson@yhbt.net</ulink>&gt;.</simpara>
</simplesect>
</article>
