<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 8.4.5" /> | |
<title>git-svn(1)</title> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { | |
color: blue; | |
text-decoration: underline; | |
} | |
a:visited { | |
color: fuchsia; | |
} | |
em { | |
font-style: italic; | |
color: navy; | |
} | |
strong { | |
font-weight: bold; | |
color: #083194; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1, h2, h3 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
padding-top: 0.5em; | |
} | |
h3 { | |
float: left; | |
} | |
h3 + * { | |
clear: left; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
ul, ol, li > p { | |
margin-top: 0; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.1em; | |
} | |
span#email { | |
} | |
span#revnumber, span#revdate, span#revremark { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble { | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock { | |
padding-left: 2.0em; | |
margin-right: 10%; | |
} | |
div.quoteblock > div.attribution { | |
padding-top: 0.5em; | |
text-align: right; | |
} | |
div.verseblock { | |
padding-left: 2.0em; | |
margin-right: 10%; | |
} | |
div.verseblock > div.content { | |
white-space: pre; | |
} | |
div.verseblock > div.attribution { | |
padding-top: 0.75em; | |
text-align: left; | |
} | |
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */ | |
div.verseblock + div.attribution { | |
text-align: left; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
span.image img { border-style: none; } | |
a.image:visited { color: white; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: normal; | |
color: navy; | |
} | |
dd > *:first-child { | |
margin-top: 0.1em; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.arabic { | |
list-style-type: decimal; | |
} | |
ol.loweralpha { | |
list-style-type: lower-alpha; | |
} | |
ol.upperalpha { | |
list-style-type: upper-alpha; | |
} | |
ol.lowerroman { | |
list-style-type: lower-roman; | |
} | |
ol.upperroman { | |
list-style-type: upper-roman; | |
} | |
div.compact ul, div.compact ol, | |
div.compact p, div.compact p, | |
div.compact div, div.compact div { | |
margin-top: 0.1em; | |
margin-bottom: 0.1em; | |
} | |
div.tableblock > table { | |
border: 3px solid #527bbd; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
td > div.verse { | |
white-space: pre; | |
} | |
p.table { | |
margin-top: 0; | |
} | |
/* Because the table frame attribute is overriden by CSS in most browsers. */ | |
div.tableblock > table[frame="void"] { | |
border-style: none; | |
} | |
div.tableblock > table[frame="hsides"] { | |
border-left-style: none; | |
border-right-style: none; | |
} | |
div.tableblock > table[frame="vsides"] { | |
border-top-style: none; | |
border-bottom-style: none; | |
} | |
div.hdlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
div.hdlist tr { | |
padding-bottom: 15px; | |
} | |
dt.hdlist1.strong, td.hdlist1.strong { | |
font-weight: bold; | |
} | |
td.hdlist1 { | |
vertical-align: top; | |
font-style: normal; | |
padding-right: 0.8em; | |
color: navy; | |
} | |
td.hdlist2 { | |
vertical-align: top; | |
} | |
div.hdlist.compact tr { | |
margin: 0; | |
padding-bottom: 0; | |
} | |
.comment { | |
background: yellow; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
div#toctitle { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-size: 1.1em; | |
font-weight: bold; | |
margin-top: 1.0em; | |
margin-bottom: 0.1em; | |
} | |
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { | |
margin-top: 0; | |
margin-bottom: 0; | |
} | |
div.toclevel2 { | |
margin-left: 2em; | |
font-size: 0.9em; | |
} | |
div.toclevel3 { | |
margin-left: 4em; | |
font-size: 0.9em; | |
} | |
div.toclevel4 { | |
margin-left: 6em; | |
font-size: 0.9em; | |
} | |
/* Overrides for manpage documents */ | |
h1 { | |
padding-top: 0.5em; | |
padding-bottom: 0.5em; | |
border-top: 2px solid silver; | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-style: none; | |
} | |
div.sectionbody { | |
margin-left: 5%; | |
} | |
@media print { | |
div#toc { display: none; } | |
} | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-attribution { | |
padding-top: 0.5em; | |
text-align: right; | |
} | |
div.verseblock-content { | |
white-space: pre; | |
} | |
div.verseblock-attribution { | |
padding-top: 0.75em; | |
text-align: left; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
/* IE6 sets dynamically generated links as visited. */ | |
div#toc a:visited { color: blue; } | |
</style> | |
</head> | |
<body> | |
<div id="header"> | |
<h1> | |
git-svn(1) Manual Page | |
</h1> | |
<h2>NAME</h2> | |
<div class="sectionbody"> | |
<p>git-svn - | |
Bidirectional operation between a Subversion repository and git | |
</p> | |
</div> | |
</div> | |
<h2 id="_synopsis">SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p><em>git svn</em> <command> [options] [arguments]</p></div> | |
</div> | |
<h2 id="_description">DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p><em>git svn</em> is a simple conduit for changesets between Subversion and git. | |
It provides a bidirectional flow of changes between a Subversion and a git | |
repository.</p></div> | |
<div class="paragraph"><p><em>git svn</em> 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 <em>init</em> below, and also the <em>clone</em> command).</p></div> | |
<div class="paragraph"><p>Once tracking a Subversion repository (with any of the above methods), the git | |
repository can be updated from Subversion by the <em>fetch</em> command and | |
Subversion updated from git by the <em>dcommit</em> command.</p></div> | |
</div> | |
<h2 id="_commands">COMMANDS</h2> | |
<div class="sectionbody"> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
<em>init</em> | |
</dt> | |
<dd> | |
<p> | |
Initializes an empty git repository with additional | |
metadata directories for <em>git svn</em>. 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. | |
</p> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-T<trunk_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
--trunk=<trunk_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
-t<tags_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
--tags=<tags_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
-b<branches_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
--branches=<branches_subdir> | |
</dt> | |
<dt class="hdlist1"> | |
-s | |
</dt> | |
<dt class="hdlist1"> | |
--stdlayout | |
</dt> | |
<dd> | |
<p> | |
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). | |
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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--no-metadata | |
</dt> | |
<dd> | |
<p> | |
Set the <em>noMetadata</em> option in the [svn-remote] config. | |
This option is not recommended, please read the <em>svn.noMetadata</em> | |
section of this manpage before using this option. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--use-svm-props | |
</dt> | |
<dd> | |
<p> | |
Set the <em>useSvmProps</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--use-svnsync-props | |
</dt> | |
<dd> | |
<p> | |
Set the <em>useSvnsyncProps</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--rewrite-root=<URL> | |
</dt> | |
<dd> | |
<p> | |
Set the <em>rewriteRoot</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--rewrite-uuid=<UUID> | |
</dt> | |
<dd> | |
<p> | |
Set the <em>rewriteUUID</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--username=<USER> | |
</dt> | |
<dd> | |
<p> | |
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://foo@svn.bar.com/project | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--prefix=<prefix> | |
</dt> | |
<dd> | |
<p> | |
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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--ignore-paths=<regex> | |
</dt> | |
<dd> | |
<p> | |
When passed to <em>init</em> or <em>clone</em> this regular expression will | |
be preserved as a config key. See <em>fetch</em> for a description | |
of <em>--ignore-paths</em>. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--no-minimize-url | |
</dt> | |
<dd> | |
<p> | |
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 <em>--no-minimize-url</em> 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). | |
</p> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>fetch</em> | |
</dt> | |
<dd> | |
<p> | |
Fetch unfetched revisions from the Subversion remote we are | |
tracking. The name of the [svn-remote "…"] section in the | |
.git/config file may be specified as an optional command-line | |
argument. | |
</p> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
--localtime | |
</dt> | |
<dd> | |
<p> | |
Store Git commit times in the local timezone instead of UTC. This | |
makes <em>git log</em> (even without --date=local) show the same times | |
that <tt>svn log</tt> would in the local timezone. | |
</p> | |
<div class="paragraph"><p>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 timezone.</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
--parent | |
</dt> | |
<dd> | |
<p> | |
Fetch only from the SVN parent of the current HEAD. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--ignore-paths=<regex> | |
</dt> | |
<dd> | |
<p> | |
This allows one to specify a Perl regular expression that will | |
cause skipping of all matching paths from checkout from SVN. | |
The <em>--ignore-paths</em> option should match for every <em>fetch</em> | |
(including automatic fetches due to <em>clone</em>, <em>dcommit</em>, | |
<em>rebase</em>, etc) on a given repository. | |
</p> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn-remote.<name>.ignore-paths</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
<div class="paragraph"><p>If the ignore-paths config key is set and the command line option is | |
also given, both regular expressions will be used.</p></div> | |
<div class="paragraph"><p>Examples:</p></div> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
Skip "doc*" directory for every fetch | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>--ignore-paths="^doc"</tt></pre> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
Skip "branches" and "tags" of first level directories | |
</dt> | |
<dd> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>--ignore-paths="^[^/]+/(?:branches|tags)"</tt></pre> | |
</div></div> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
--use-log-author | |
</dt> | |
<dd> | |
<p> | |
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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--add-author-from | |
</dt> | |
<dd> | |
<p> | |
When committing to svn from git (as part of commit or dcommit | |
operations), if the existing log message doesn’t already have a | |
From: or Signed-off-by: line, append a From: line based on the | |
git commit’s author string. If you use this, then --use-log-author | |
will retrieve a valid author string for all commits. | |
</p> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>clone</em> | |
</dt> | |
<dd> | |
<p> | |
Runs <em>init</em> and <em>fetch</em>. 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 | |
<em>init</em> and <em>fetch</em> commands accept; with the exception of | |
<em>--fetch-all</em> and <em>--parent</em>. After a repository is cloned, | |
the <em>fetch</em> command will be able to update revisions without | |
affecting the working tree; and the <em>rebase</em> command will be | |
able to update the working tree with the latest changes. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>rebase</em> | |
</dt> | |
<dd> | |
<p> | |
This fetches revisions from the SVN parent of the current HEAD | |
and rebases the current (uncommitted to SVN) work against it. | |
</p> | |
<div class="paragraph"><p>This works similarly to <tt>svn update</tt> or <em>git pull</em> except that | |
it preserves linear history with <em>git rebase</em> instead of | |
<em>git merge</em> for ease of dcommitting with <em>git svn</em>.</p></div> | |
<div class="paragraph"><p>This accepts all options that <em>git svn fetch</em> and <em>git rebase</em> | |
accept. However, <em>--fetch-all</em> only fetches from the current | |
[svn-remote], and not all [svn-remote] definitions.</p></div> | |
<div class="paragraph"><p>Like <em>git rebase</em>; this requires that the working tree be clean | |
and have no uncommitted changes.</p></div> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-l | |
</dt> | |
<dt class="hdlist1"> | |
--local | |
</dt> | |
<dd> | |
<p> | |
Do not fetch remotely; only run <em>git rebase</em> against the | |
last fetched commit from the upstream SVN. | |
</p> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>dcommit</em> | |
</dt> | |
<dd> | |
<p> | |
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 <em>git svn</em> fetch and rebase (not | |
pull or merge) your commits against the latest changes in the | |
SVN repository. | |
An optional revision or branch argument may be specified, and | |
causes <em>git svn</em> to do all work on that revision/branch | |
instead of HEAD. | |
This is advantageous over <em>set-tree</em> (below) because it produces | |
cleaner, more linear history. | |
</p> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
--no-rebase | |
</dt> | |
<dd> | |
<p> | |
After committing, do not rebase or reset. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--commit-url <URL> | |
</dt> | |
<dd> | |
<p> | |
Commit to this SVN URL (the full path). This is intended to | |
allow existing <em>git svn</em> repositories created with one transport | |
method (e.g. <tt>svn://</tt> or <tt>http://</tt> for anonymous read) to be | |
reused if a user is later given access to an alternate transport | |
method (e.g. <tt>svn+ssh://</tt> or <tt>https://</tt>) for commit. | |
</p> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn-remote.<name>.commiturl | |
config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
<div class="paragraph"><p>Using this option for any other purpose (don’t ask) is very strongly | |
discouraged.</p></div> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>branch</em> | |
</dt> | |
<dd> | |
<p> | |
Create a branch in the SVN repository. | |
</p> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-m | |
</dt> | |
<dt class="hdlist1"> | |
--message | |
</dt> | |
<dd> | |
<p> | |
Allows to specify the commit message. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-t | |
</dt> | |
<dt class="hdlist1"> | |
--tag | |
</dt> | |
<dd> | |
<p> | |
Create a tag by using the tags_subdir instead of the branches_subdir | |
specified during git svn init. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-d | |
</dt> | |
<dt class="hdlist1"> | |
--destination | |
</dt> | |
<dd> | |
<p> | |
If more than one --branches (or --tags) option was given to the <em>init</em> | |
or <em>clone</em> command, you must provide the location of the branch (or | |
tag) you wish to create in the SVN repository. The value of this | |
option must match one of the paths specified by a --branches (or | |
--tags) option. You can see these paths with the commands | |
</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>git config --get-all svn-remote.<name>.branches | |
git config --get-all svn-remote.<name>.tags</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>where <name> is the name of the SVN repository as specified by the -R option to | |
<em>init</em> (or "svn" by default).</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
--username | |
</dt> | |
<dd> | |
<p> | |
Specify the SVN username to perform the commit as. This option overrides | |
the <em>username</em> configuration property. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--commit-url | |
</dt> | |
<dd> | |
<p> | |
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 <em>commiturl</em>. | |
</p> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>git config --get-all svn-remote.<name>.commiturl</tt></pre> | |
</div></div> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>tag</em> | |
</dt> | |
<dd> | |
<p> | |
Create a tag in the SVN repository. This is a shorthand for | |
<em>branch -t</em>. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>log</em> | |
</dt> | |
<dd> | |
<p> | |
This should make it easy to look up svn log messages when svn | |
users refer to -r/--revision numbers. | |
</p> | |
<div class="paragraph"><p>The following features from ‘svn log’ are supported:</p></div> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-r <n>[:<n>] | |
</dt> | |
<dt class="hdlist1"> | |
--revision=<n>[:<n>] | |
</dt> | |
<dd> | |
<p> | |
is supported, non-numeric args are not: | |
HEAD, NEXT, BASE, PREV, etc … | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-v | |
</dt> | |
<dt class="hdlist1"> | |
--verbose | |
</dt> | |
<dd> | |
<p> | |
it’s not completely compatible with the --verbose | |
output in svn log, but reasonably close. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--limit=<n> | |
</dt> | |
<dd> | |
<p> | |
is NOT the same as --max-count, doesn’t count | |
merged/excluded commits | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--incremental | |
</dt> | |
<dd> | |
<p> | |
supported | |
</p> | |
</dd> | |
</dl></div> | |
<div class="paragraph"><p>New features:</p></div> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
--show-commit | |
</dt> | |
<dd> | |
<p> | |
shows the git commit sha1, as well | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--oneline | |
</dt> | |
<dd> | |
<p> | |
our version of --pretty=oneline | |
</p> | |
</dd> | |
</dl></div> | |
<div class="admonitionblock"> | |
<table><tr> | |
<td class="icon"> | |
<div class="title">Note</div> | |
</td> | |
<td class="content">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.</td> | |
</tr></table> | |
</div> | |
<div class="paragraph"><p>Any other arguments are passed directly to <em>git log</em></p></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>blame</em> | |
</dt> | |
<dd> | |
<p> | |
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 copy are ignored; | |
the version of the file in the HEAD revision is annotated. Unknown | |
arguments are passed directly to <em>git blame</em>. | |
</p> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
--git-format | |
</dt> | |
<dd> | |
<p> | |
Produce output in the same format as <em>git blame</em>, but with | |
SVN revision numbers instead of git commit hashes. In this mode, | |
changes that haven’t been committed to SVN (including local | |
working-copy edits) are shown as revision 0. | |
</p> | |
</dd> | |
</dl></div> | |
</dd> | |
<dt class="hdlist1"> | |
<em>find-rev</em> | |
</dt> | |
<dd> | |
<p> | |
When given an SVN revision number of the form <em>rN</em>, 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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>set-tree</em> | |
</dt> | |
<dd> | |
<p> | |
You should consider using <em>dcommit</em> 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 <em>git svn</em> functions. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>create-ignore</em> | |
</dt> | |
<dd> | |
<p> | |
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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>show-ignore</em> | |
</dt> | |
<dd> | |
<p> | |
Recursively finds and lists the svn:ignore property on | |
directories. The output is suitable for appending to | |
the $GIT_DIR/info/exclude file. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>mkdirs</em> | |
</dt> | |
<dd> | |
<p> | |
Attempts to recreate empty directories that core git cannot track | |
based on information in $GIT_DIR/svn/<refname>/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". | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>commit-diff</em> | |
</dt> | |
<dd> | |
<p> | |
Commits the diff of two tree-ish arguments from the | |
command-line. This command does not rely on being inside an <tt>git svn | |
init</tt>-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 <em>git svn</em>-aware | |
repository (that has been <tt>init</tt>-ed with <em>git svn</em>). | |
The -r<revision> option is required for this. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>info</em> | |
</dt> | |
<dd> | |
<p> | |
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 | |
<em>URL:</em> field. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>proplist</em> | |
</dt> | |
<dd> | |
<p> | |
Lists the properties stored in the Subversion repository about a | |
given file or directory. Use -r/--revision to refer to a specific | |
Subversion revision. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>propget</em> | |
</dt> | |
<dd> | |
<p> | |
Gets the Subversion property given as the first argument, for a | |
file. A specific revision can be specified with -r/--revision. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>show-externals</em> | |
</dt> | |
<dd> | |
<p> | |
Shows the Subversion externals. Use -r/--revision to specify a | |
specific revision. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>gc</em> | |
</dt> | |
<dd> | |
<p> | |
Compress $GIT_DIR/svn/<refname>/unhandled.log files in .git/svn | |
and remove $GIT_DIR/svn/<refname>index files in .git/svn. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
<em>reset</em> | |
</dt> | |
<dd> | |
<p> | |
Undoes the effects of <em>fetch</em> back to the specified revision. | |
This allows you to re-<em>fetch</em> an SVN revision. Normally the | |
contents of an SVN revision should never change and <em>reset</em> | |
should not be necessary. However, if SVN permissions change, | |
or if you alter your --ignore-paths option, a <em>fetch</em> 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 <em>reset</em>. | |
</p> | |
<div class="paragraph"><p>Only the rev_map and refs/remotes/git-svn are changed. Follow <em>reset</em> | |
with a <em>fetch</em> and then <em>git reset</em> or <em>git rebase</em> to move local | |
branches onto the new tree.</p></div> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-r <n> | |
</dt> | |
<dt class="hdlist1"> | |
--revision=<n> | |
</dt> | |
<dd> | |
<p> | |
Specify the most recent revision to keep. All later revisions | |
are discarded. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-p | |
</dt> | |
<dt class="hdlist1"> | |
--parent | |
</dt> | |
<dd> | |
<p> | |
Discard the specified revision as well, keeping the nearest | |
parent instead. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
Example: | |
</dt> | |
<dd> | |
<p> | |
Assume you have local changes in "master", but you need to refetch "r2". | |
</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> r1---r2---r3 remotes/git-svn | |
\ | |
A---B master</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>Fix the ignore-paths or SVN permissions problem that caused "r2" to | |
be incomplete in the first place. Then:</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">git svn reset -r2 -p | |
git svn fetch</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> r1---r2'--r3' remotes/git-svn | |
\ | |
r2---r3---A---B master</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>Then fixup "master" with <em>git rebase</em>. | |
Do NOT use <em>git merge</em> or your history will not be compatible with a | |
future <em>dcommit</em>!</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">git rebase --onto remotes/git-svn A^ master</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> r1---r2'--r3' remotes/git-svn | |
\ | |
A'--B' master</tt></pre> | |
</div></div> | |
</dd> | |
</dl></div> | |
</dd> | |
</dl></div> | |
</div> | |
<h2 id="_options">OPTIONS</h2> | |
<div class="sectionbody"> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
--shared[=(false|true|umask|group|all|world|everybody)] | |
</dt> | |
<dt class="hdlist1"> | |
--template=<template_directory> | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>init</em> command. | |
These are passed directly to <em>git init</em>. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-r <ARG> | |
</dt> | |
<dt class="hdlist1"> | |
--revision <ARG> | |
</dt> | |
<dd> | |
<p> | |
Used with the <em>fetch</em> command. | |
</p> | |
<div class="paragraph"><p>This allows revision ranges for partial/cauterized history | |
to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges), | |
$NUMBER:HEAD, and BASE:$NUMBER are all supported.</p></div> | |
<div class="paragraph"><p>This can allow you to make partial mirrors when running fetch; | |
but is generally not recommended because history will be skipped | |
and lost.</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
- | |
</dt> | |
<dt class="hdlist1"> | |
--stdin | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>set-tree</em> command. | |
</p> | |
<div class="paragraph"><p>Read a list of commits from stdin and commit them in reverse | |
order. Only the leading sha1 is read from each line, so | |
<em>git rev-list --pretty=oneline</em> output can be used.</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
--rmdir | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<div class="paragraph"><p>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.</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.rmdir</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
-e | |
</dt> | |
<dt class="hdlist1"> | |
--edit | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<div class="paragraph"><p>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.</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.edit</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
-l<num> | |
</dt> | |
<dt class="hdlist1"> | |
--find-copies-harder | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<div class="paragraph"><p>They are both passed directly to <em>git diff-tree</em>; see | |
<a href="git-diff-tree.html">git-diff-tree(1)</a> for more information.</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.l | |
config key: svn.findcopiesharder</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
-A<filename> | |
</dt> | |
<dt class="hdlist1"> | |
--authors-file=<filename> | |
</dt> | |
<dd> | |
<p> | |
Syntax is compatible with the file used by <em>git cvsimport</em>: | |
</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> loginname = Joe User <user@example.com></tt></pre> | |
</div></div> | |
<div class="paragraph"><p>If this option is specified and <em>git svn</em> encounters an SVN | |
committer name that does not exist in the authors-file, <em>git svn</em> | |
will abort operation. The user will then have to add the | |
appropriate entry. Re-running the previous <em>git svn</em> command | |
after the authors-file is modified should continue operation.</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.authorsfile</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
--authors-prog=<filename> | |
</dt> | |
<dd> | |
<p> | |
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 <email>", | |
which will be treated as if included in the authors file. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-q | |
</dt> | |
<dt class="hdlist1"> | |
--quiet | |
</dt> | |
<dd> | |
<p> | |
Make <em>git svn</em> less verbose. Specify a second time to make it | |
even less verbose. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--repack[=<n>] | |
</dt> | |
<dt class="hdlist1"> | |
--repack-flags=<flags> | |
</dt> | |
<dd> | |
<p> | |
These should help keep disk usage sane for large fetches with | |
many revisions. | |
</p> | |
<div class="paragraph"><p>--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.</p></div> | |
<div class="paragraph"><p>--repack-flags are passed directly to <em>git repack</em>.</p></div> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.repack | |
config key: svn.repackflags</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
<dt class="hdlist1"> | |
-m | |
</dt> | |
<dt class="hdlist1"> | |
--merge | |
</dt> | |
<dt class="hdlist1"> | |
-s<strategy> | |
</dt> | |
<dt class="hdlist1"> | |
--strategy=<strategy> | |
</dt> | |
<dd> | |
<p> | |
These are only used with the <em>dcommit</em> and <em>rebase</em> commands. | |
</p> | |
<div class="paragraph"><p>Passed directly to <em>git rebase</em> when using <em>dcommit</em> if a | |
<em>git reset</em> cannot be used (see <em>dcommit</em>).</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
-n | |
</dt> | |
<dt class="hdlist1"> | |
--dry-run | |
</dt> | |
<dd> | |
<p> | |
This can be used with the <em>dcommit</em>, <em>rebase</em>, <em>branch</em> and | |
<em>tag</em> commands. | |
</p> | |
<div class="paragraph"><p>For <em>dcommit</em>, print out the series of git arguments that would show | |
which diffs would be committed to SVN.</p></div> | |
<div class="paragraph"><p>For <em>rebase</em>, 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.</p></div> | |
<div class="paragraph"><p>For <em>branch</em> and <em>tag</em>, display the urls that will be used for copying when | |
creating the branch or tag.</p></div> | |
</dd> | |
</dl></div> | |
</div> | |
<h2 id="_advanced_options">ADVANCED OPTIONS</h2> | |
<div class="sectionbody"> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
-i<GIT_SVN_ID> | |
</dt> | |
<dt class="hdlist1"> | |
--id <GIT_SVN_ID> | |
</dt> | |
<dd> | |
<p> | |
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 <em>log</em> and <em>dcommit</em> commands | |
no longer require this switch as an argument. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
-R<remote name> | |
</dt> | |
<dt class="hdlist1"> | |
--svn-remote <remote name> | |
</dt> | |
<dd> | |
<p> | |
Specify the [svn-remote "<remote name>"] section to use, | |
this allows SVN multiple repositories to be tracked. | |
Default: "svn" | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
--follow-parent | |
</dt> | |
<dd> | |
<p> | |
This is especially helpful when we’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. | |
</p> | |
<div class="verseblock"> | |
<div class="verseblock-content">config key: svn.followparent</div> | |
<div class="verseblock-attribution"> | |
</div></div> | |
</dd> | |
</dl></div> | |
</div> | |
<h2 id="_config_file_only_options">CONFIG FILE-ONLY OPTIONS</h2> | |
<div class="sectionbody"> | |
<div class="dlist"><dl> | |
<dt class="hdlist1"> | |
svn.noMetadata | |
</dt> | |
<dt class="hdlist1"> | |
svn-remote.<name>.noMetadata | |
</dt> | |
<dd> | |
<p> | |
This gets rid of the <em>git-svn-id:</em> lines at the end of every commit. | |
</p> | |
<div class="paragraph"><p>This option can only be used for one-shot imports as <em>git svn</em> | |
will not be able to fetch again without metadata. Additionally, | |
if you lose your .git/svn/<strong>*/.rev_map.</strong> files, <em>git svn</em> will not | |
be able to rebuild them.</p></div> | |
<div class="paragraph"><p>The <em>git svn log</em> command will not work on repositories using | |
this, either. Using this conflicts with the <em>useSvmProps</em> | |
option for (hopefully) obvious reasons.</p></div> | |
<div class="paragraph"><p>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 | |
<a href="git-filter-branch.html">git-filter-branch(1)</a> instead. filter-branch also allows | |
reformating of metadata for ease-of-reading and rewriting authorship | |
info for non-"svn.authorsFile" users.</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
svn.useSvmProps | |
</dt> | |
<dt class="hdlist1"> | |
svn-remote.<name>.useSvmProps | |
</dt> | |
<dd> | |
<p> | |
This allows <em>git svn</em> to re-map repository URLs and UUIDs from | |
mirrors created using SVN::Mirror (or svk) for metadata. | |
</p> | |
<div class="paragraph"><p>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.</p></div> | |
</dd> | |
<dt class="hdlist1"> | |
svn.useSvnsyncProps | |
</dt> | |
<dt class="hdlist1"> | |
svn-remote.<name>.useSvnsyncprops | |
</dt> | |
<dd> | |
<p> | |
Similar to the useSvmProps option; this is for users | |
of the svnsync(1) command distributed with SVN 1.4.x and | |
later. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
svn-remote.<name>.rewriteRoot | |
</dt> | |
<dd> | |
<p> | |
This allows users to create repositories from alternate | |
URLs. For example, an administrator could run <em>git svn</em> 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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
svn-remote.<name>.rewriteUUID | |
</dt> | |
<dd> | |
<p> | |
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. | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
svn.brokenSymlinkWorkaround | |
</dt> | |
<dd> | |
<p> | |
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 <em>git svn</em> is running and take effect on the next | |
revision fetched. If unset, <em>git svn</em> assumes this option to | |
be "true". | |
</p> | |
</dd> | |
<dt class="hdlist1"> | |
svn.pathnameencoding | |
</dt> | |
<dd> | |
<p> | |
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. | |
</p> | |
</dd> | |
</dl></div> | |
<div class="paragraph"><p>Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps | |
options all affect the metadata generated and used by <em>git svn</em>; they | |
<strong>must</strong> be set in the configuration file before any history is imported | |
and these settings should never be changed once they are set.</p></div> | |
<div class="paragraph"><p>Additionally, only one of these options can be used per svn-remote | |
section because they affect the <em>git-svn-id:</em> metadata line, except | |
for rewriteRoot and rewriteUUID which can be used together.</p></div> | |
</div> | |
<h2 id="_basic_examples">BASIC EXAMPLES</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>Tracking and contributing to the trunk of a Subversion-managed project:</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt># 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 >> .git/info/exclude</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>Tracking and contributing to an entire Subversion-managed project | |
(complete with a trunk, tags and branches):</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt># 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.</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>The initial <em>git svn clone</em> can be quite time-consuming | |
(especially for large Subversion repositories). If multiple | |
people (or one person with multiple machines) want to use | |
<em>git svn</em> to interact with the same Subversion repository, you can | |
do the initial <em>git svn clone</em> to a repository on a server and | |
have each person clone that repository with <em>git clone</em>:</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt># Do the initial import on a server | |
ssh server "cd /pub && 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</tt></pre> | |
</div></div> | |
</div> | |
<h2 id="_rebase_vs_pull_merge">REBASE VS. PULL/MERGE</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>Originally, <em>git svn</em> recommended that the <em>remotes/git-svn</em> branch be | |
pulled or merged from. This is because the author favored | |
<tt>git svn set-tree B</tt> to commit a single head rather than the | |
<tt>git svn set-tree A..B</tt> notation to commit multiple commits.</p></div> | |
<div class="paragraph"><p>If you use <tt>git svn set-tree A..B</tt> to commit several diffs and you do | |
not have the latest remotes/git-svn merged into my-branch, you should | |
use <tt>git svn rebase</tt> to update your work branch instead of <tt>git pull</tt> or | |
<tt>git merge</tt>. <tt>pull</tt>/<tt>merge</tt> can cause non-linear history to be flattened | |
when committing into SVN, which can lead to merge commits reversing | |
previous commits in SVN.</p></div> | |
</div> | |
<h2 id="_design_philosophy">DESIGN PHILOSOPHY</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>Merge tracking in Subversion is lacking and doing branched development | |
with Subversion can be cumbersome as a result. While <em>git svn</em> 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).</p></div> | |
</div> | |
<h2 id="_caveats">CAVEATS</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>For the sake of simplicity and interoperating with a less-capable system | |
(SVN), it is recommended that all <em>git svn</em> users clone, fetch and dcommit | |
directly from the SVN server, and avoid all <em>git clone</em>/<em>pull</em>/<em>merge</em>/<em>push</em> | |
operations between git repositories and branches. The recommended | |
method of exchanging code between git branches and users is | |
<em>git format-patch</em> and <em>git am</em>, or just 'dcommit’ing to the SVN repository.</p></div> | |
<div class="paragraph"><p>Running <em>git merge</em> or <em>git pull</em> is NOT recommended on a branch you | |
plan to <em>dcommit</em> from. Subversion does not represent merges in any | |
reasonable or useful fashion; so users using Subversion 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, <em>dcommit</em> may commit to the wrong | |
branch.</p></div> | |
<div class="paragraph"><p>If you do merge, note the following rule: <em>git svn dcommit</em> will | |
attempt to commit on top of the SVN commit named in</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>git log --grep=^git-svn-id: --first-parent -1</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>You <em>must</em> therefore ensure that the most recent commit of the branch | |
you want to dcommit to is the <em>first</em> parent of the merge. Chaos will | |
ensue otherwise, especially if the first parent is an older commit on | |
the same SVN branch.</p></div> | |
<div class="paragraph"><p><em>git clone</em> does not clone branches under the refs/remotes/ hierarchy or | |
any <em>git svn</em> metadata, or config. So repositories created and managed with | |
using <em>git svn</em> should use <em>rsync</em> for cloning, if cloning is to be done | |
at all.</p></div> | |
<div class="paragraph"><p>Since <em>dcommit</em> uses rebase internally, any git branches you <em>git push</em> to | |
before <em>dcommit</em> on will require forcing an overwrite of the existing ref | |
on the remote repository. This is generally considered bad practice, | |
see the <a href="git-push.html">git-push(1)</a> documentation for details.</p></div> | |
<div class="paragraph"><p>Do not use the --amend option of <a href="git-commit.html">git-commit(1)</a> 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.</p></div> | |
<div class="paragraph"><p>When using multiple --branches or --tags, <em>git svn</em> 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 <em>init</em> to set up your git repository then, before your first <em>fetch</em>, edit | |
the .git/config file so that the branches and tags are associated with | |
different name spaces. For example:</p></div> | |
<div class="literalblock"> | |
<div class="content"> | |
<pre><tt>branches = stable/*:refs/remotes/svn/stable/* | |
branches = debug/*:refs/remotes/svn/debug/*</tt></pre> | |
</div></div> | |
</div> | |
<h2 id="_bugs">BUGS</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>We ignore all SVN properties except svn:executable. Any unhandled | |
properties are logged to $GIT_DIR/svn/<refname>/unhandled.log</p></div> | |
<div class="paragraph"><p>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 are fully supported if they’re similar enough | |
for git to detect them.</p></div> | |
</div> | |
<h2 id="_configuration">CONFIGURATION</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p><em>git svn</em> stores [svn-remote] configuration information in the | |
repository .git/config file. It is similar the core git | |
[remote] sections except <em>fetch</em> keys do not accept glob | |
arguments; but they are instead handled by the <em>branches</em> | |
and <em>tags</em> keys. Since some SVN repositories are oddly | |
configured with multiple projects glob expansions such those | |
listed below are allowed:</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>[svn-remote "project-a"] | |
url = http://server.org/svn | |
fetch = trunk/project-a:refs/remotes/project-a/trunk | |
branches = branches/*/project-a:refs/remotes/project-a/branches/* | |
tags = tags/*/project-a:refs/remotes/project-a/tags/*</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>Keep in mind that the <em>*</em> (asterisk) wildcard of the local ref | |
(right of the <em>:</em>) <strong>must</strong> be the farthest right path component; | |
however the remote wildcard may be anywhere as long as it’s an | |
independent path component (surrounded by <em>/</em> or EOL). This | |
type of configuration is not automatically created by <em>init</em> and | |
should be manually entered with a text-editor or using <em>git config</em>.</p></div> | |
<div class="paragraph"><p>It is also possible to fetch a subset of branches or tags by using a | |
comma-separated list of names within braces. For example:</p></div> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt>[svn-remote "huge-project"] | |
url = http://server.org/svn | |
fetch = trunk/src:refs/remotes/trunk | |
branches = branches/{red,green}/src:refs/remotes/branches/* | |
tags = tags/{1.0,2.0}/src:refs/remotes/tags/*</tt></pre> | |
</div></div> | |
<div class="paragraph"><p>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/svn/.metadata must be manually edited to remove (or | |
reset) branches-maxRev and/or tags-maxRev as appropriate.</p></div> | |
</div> | |
<h2 id="_see_also">SEE ALSO</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p><a href="git-rebase.html">git-rebase(1)</a></p></div> | |
</div> | |
<h2 id="_author">Author</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>Written by Eric Wong <<a href="mailto:normalperson@yhbt.net">normalperson@yhbt.net</a>>.</p></div> | |
</div> | |
<h2 id="_documentation">Documentation</h2> | |
<div class="sectionbody"> | |
<div class="paragraph"><p>Written by Eric Wong <<a href="mailto:normalperson@yhbt.net">normalperson@yhbt.net</a>>.</p></div> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 2010-11-06 00:41:57 UTC | |
</div> | |
</div> | |
</body> | |
</html> |