<!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 7.0.2" /> | |
<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; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
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 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
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, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
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 { | |
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 > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
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.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
include::./stylesheets/xhtml11-manpage.css[] | |
/* 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 { | |
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-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>git-svn(1)</title> | |
</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 single Subversion branch and git | |
</p> | |
</div> | |
</div> | |
<h2>SYNOPSIS</h2> | |
<div class="sectionbody"> | |
<p><em>git-svn</em> <command> [options] [arguments]</p> | |
</div> | |
<h2>DESCRIPTION</h2> | |
<div class="sectionbody"> | |
<p>git-svn is a simple conduit for changesets between Subversion and git. | |
It is not to be confused with <a href="git-svnimport.html">git-svnimport(1)</a>, which is | |
read-only.</p> | |
<p>git-svn was originally designed for an individual developer who wants a | |
bidirectional flow of changesets between a single branch in Subversion | |
and an arbitrary number of branches in git. Since its inception, | |
git-svn has gained the ability to track multiple branches in a manner | |
similar to git-svnimport.</p> | |
<p>git-svn is especially useful when it comes to tracking repositories | |
not organized in the way Subversion developers recommend (trunk, | |
branches, tags directories).</p> | |
</div> | |
<h2>COMMANDS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
<em>init</em> | |
</dt> | |
<dd> | |
<p> | |
Initializes an empty git repository with additional | |
metadata directories for git-svn. The Subversion URL | |
may be specified as a command-line argument, or as full | |
URL arguments to -T/-t/-b. Optionally, the target | |
directory to operate on can be specified as a second | |
argument. Normally this command initializes the current | |
directory. | |
</p> | |
<dl> | |
<dt> | |
-T<trunk_subdir> | |
</dt> | |
<dt> | |
--trunk=<trunk_subdir> | |
</dt> | |
<dt> | |
-t<tags_subdir> | |
</dt> | |
<dt> | |
--tags=<tags_subdir> | |
</dt> | |
<dt> | |
-b<branches_subdir> | |
</dt> | |
<dt> | |
--branches=<branches_subdir> | |
</dt> | |
<dt> | |
-s | |
</dt> | |
<dt> | |
--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). 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> | |
--no-metadata | |
</dt> | |
<dd> | |
<p> | |
Set the <em>noMetadata</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt> | |
--use-svm-props | |
</dt> | |
<dd> | |
<p> | |
Set the <em>useSvmProps</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt> | |
--use-svnsync-props | |
</dt> | |
<dd> | |
<p> | |
Set the <em>useSvnsyncProps</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt> | |
--rewrite-root=<URL> | |
</dt> | |
<dd> | |
<p> | |
Set the <em>rewriteRoot</em> option in the [svn-remote] config. | |
</p> | |
</dd> | |
<dt> | |
--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> | |
--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> | |
</dl> | |
</dd> | |
<dt> | |
<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> | |
</dd> | |
<dt> | |
<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>. 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> | |
<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> | |
<p>This works similarly to <em>svn update</em> 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 dcommiting with git-svn.</p> | |
<p>This accepts all options that <em>git-svn fetch</em> and <em>git-rebase</em> | |
accepts. However <em>--fetch-all</em> only fetches from the current | |
[svn-remote], and not all [svn-remote] definitions.</p> | |
<p>Like <em>git-rebase</em>; this requires that the working tree be clean | |
and have no uncommitted changes.</p> | |
<dl> | |
<dt> | |
-l | |
</dt> | |
<dt> | |
--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> | |
</dd> | |
<dt> | |
<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 git-svn 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 <em>set-tree</em> (below) because it produces | |
cleaner, more linear history.<br /> | |
</p> | |
<dl> | |
<dt> | |
--no-rebase | |
</dt> | |
<dd> | |
<p> | |
After committing, do not rebase or reset. | |
</p> | |
</dd> | |
</dl> | |
</dd> | |
</dl> | |
<dl> | |
<dt> | |
<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> | |
<p>The following features from `svn log' are supported:</p> | |
<dl> | |
<dt> | |
--revision=<n>[:<n>] | |
</dt> | |
<dd> | |
<p> | |
is supported, non-numeric args are not: | |
HEAD, NEXT, BASE, PREV, etc … | |
</p> | |
</dd> | |
<dt> | |
-v/--verbose | |
</dt> | |
<dd> | |
<p> | |
it's not completely compatible with the --verbose | |
output in svn log, but reasonably close. | |
</p> | |
</dd> | |
<dt> | |
--limit=<n> | |
</dt> | |
<dd> | |
<p> | |
is NOT the same as --max-count, doesn't count | |
merged/excluded commits | |
</p> | |
</dd> | |
<dt> | |
--incremental | |
</dt> | |
<dd> | |
<p> | |
supported | |
</p> | |
</dd> | |
</dl> | |
<p>New features:</p> | |
<dl> | |
<dt> | |
--show-commit | |
</dt> | |
<dd> | |
<p> | |
shows the git commit sha1, as well | |
</p> | |
</dd> | |
<dt> | |
--oneline | |
</dt> | |
<dd> | |
<p> | |
our version of --pretty=oneline | |
</p> | |
</dd> | |
</dl> | |
<p>Any other arguments are passed directly to `git log'</p> | |
</dd> | |
</dl> | |
<dl> | |
<dt> | |
<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> | |
<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 git-svn functions. | |
</p> | |
</dd> | |
<dt> | |
<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> | |
<em>commit-diff</em> | |
</dt> | |
<dd> | |
<p> | |
Commits the diff of two tree-ish arguments from the | |
command-line. This command is intended for interoperability with | |
git-svnimport and does not rely on being inside an git-svn | |
init-ed repository. This command takes three arguments, (a) the | |
original tree to diff against, (b) the new tree result, (c) the | |
URL of the target Subversion repository. The final argument | |
(URL) may be omitted if you are working from a git-svn-aware | |
repository (that has been init-ed with git-svn). | |
The -r<revision> option is required for this. | |
</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
--shared[={false|true|umask|group|all|world|everybody}] | |
</dt> | |
<dt> | |
--template=<template_directory> | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>init</em> command. | |
These are passed directly to <a href="git-init.html">git-init(1)</a>. | |
</p> | |
</dd> | |
<dt> | |
-r <ARG> | |
</dt> | |
<dt> | |
--revision <ARG> | |
</dt> | |
<dd> | |
<p> | |
Used with the <em>fetch</em> command. | |
</p> | |
<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> | |
<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> | |
</dd> | |
<dt> | |
- | |
</dt> | |
<dt> | |
--stdin | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>set-tree</em> command. | |
</p> | |
<p>Read a list of commits from stdin and commit them in reverse | |
order. Only the leading sha1 is read from each line, so | |
git-rev-list --pretty=oneline output can be used.</p> | |
</dd> | |
<dt> | |
--rmdir | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<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> | |
<p>config key: svn.rmdir</p> | |
</dd> | |
<dt> | |
-e | |
</dt> | |
<dt> | |
--edit | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<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> | |
<p>config key: svn.edit</p> | |
</dd> | |
<dt> | |
-l<num> | |
</dt> | |
<dt> | |
--find-copies-harder | |
</dt> | |
<dd> | |
<p> | |
Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands. | |
</p> | |
<p>They are both passed directly to git-diff-tree see | |
<a href="git-diff-tree.html">git-diff-tree(1)</a> for more information.</p> | |
<div class="verseblock"> | |
<div class="content">config key: svn.l | |
config key: svn.findcopiesharder</div></div> | |
</dd> | |
<dt> | |
-A<filename> | |
</dt> | |
<dt> | |
--authors-file=<filename> | |
</dt> | |
<dd> | |
<p> | |
Syntax is compatible with the files used by git-svnimport and | |
git-cvsimport: | |
</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt> loginname = Joe User <user@example.com></tt></pre> | |
</div></div> | |
<p>If this option is specified and git-svn encounters an SVN | |
committer name that does not exist in the authors-file, git-svn | |
will abort operation. The user will then have to add the | |
appropriate entry. Re-running the previous git-svn command | |
after the authors-file is modified should continue operation.</p> | |
<p>config key: svn.authorsfile</p> | |
</dd> | |
<dt> | |
-q | |
</dt> | |
<dt> | |
--quiet | |
</dt> | |
<dd> | |
<p> | |
Make git-svn less verbose. | |
</p> | |
</dd> | |
<dt> | |
--repack[=<n>] | |
</dt> | |
<dt> | |
--repack-flags=<flags> | |
</dt> | |
<dd> | |
<p> | |
These should help keep disk usage sane for large fetches | |
with many revisions. | |
</p> | |
<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> | |
<p>--repack-flags are passed directly to <a href="git-repack.html">git-repack(1)</a>.</p> | |
<div class="verseblock"> | |
<div class="content">config key: svn.repack | |
config key: svn.repackflags</div></div> | |
</dd> | |
<dt> | |
-m | |
</dt> | |
<dt> | |
--merge | |
</dt> | |
<dt> | |
-s<strategy> | |
</dt> | |
<dt> | |
--strategy=<strategy> | |
</dt> | |
<dd> | |
<p> | |
These are only used with the <em>dcommit</em> and <em>rebase</em> commands. | |
</p> | |
<p>Passed directly to git-rebase when using <em>dcommit</em> if a | |
<em>git-reset</em> cannot be used (see dcommit).</p> | |
</dd> | |
<dt> | |
-n | |
</dt> | |
<dt> | |
--dry-run | |
</dt> | |
<dd> | |
<p> | |
This is only used with the <em>dcommit</em> command. | |
</p> | |
<p>Print out the series of git arguments that would show | |
which diffs would be committed to SVN.</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>ADVANCED OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
-i<GIT_SVN_ID> | |
</dt> | |
<dt> | |
--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> | |
-R<remote name> | |
</dt> | |
<dt> | |
--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> | |
--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> | |
<p>config key: svn.followparent</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>CONFIG FILE-ONLY OPTIONS</h2> | |
<div class="sectionbody"> | |
<dl> | |
<dt> | |
svn.noMetadata | |
</dt> | |
<dt> | |
svn-remote.<name>.noMetadata | |
</dt> | |
<dd> | |
<p> | |
This gets rid of the git-svn-id: lines at the end of every commit. | |
</p> | |
<p>If you lose your .git/svn/git-svn/.rev_db file, git-svn will not | |
be able to rebuild it and you won't be able to fetch again, | |
either. This is fine for one-shot imports.</p> | |
<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> | |
</dd> | |
<dt> | |
svn.useSvmProps | |
</dt> | |
<dt> | |
svn-remote.<name>.useSvmProps | |
</dt> | |
<dd> | |
<p> | |
This allows git-svn to re-map repository URLs and UUIDs from | |
mirrors created using SVN::Mirror (or svk) for metadata. | |
</p> | |
<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> | |
</dd> | |
<dt> | |
svn.useSvnsyncProps | |
</dt> | |
<dt> | |
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> | |
svn-remote.<name>.rewriteRoot | |
</dt> | |
<dd> | |
<p> | |
This allows users to create repositories from alternate | |
URLs. For example, an administrator could run git-svn on the | |
server locally (accessing via file://) but wish to distribute | |
the repository with a public http:// or svn:// URL in the | |
metadata so users of it will see the public URL. | |
</p> | |
<p>Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps | |
options all affect the metadata generated and used by git-svn; 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> | |
<p>Additionally, only one of these four options can be used per-svn-remote | |
section because they affect the <em>git-svn-id:</em> metadata line.</p> | |
</dd> | |
</dl> | |
</div> | |
<h2>BASIC EXAMPLES</h2> | |
<div class="sectionbody"> | |
<p>Tracking and contributing to a the trunk of a Subversion-managed project:</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt># Clone a repo (like git clone): | |
git-svn clone http://svn.foo.org/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> | |
<p>Tracking and contributing to an entire Subversion-managed project | |
(complete with a trunk, tags and branches):</p> | |
<div class="listingblock"> | |
<div class="content"> | |
<pre><tt># Clone a repo (like git clone): | |
git-svn clone http://svn.foo.org/project -T trunk -b branches -t tags | |
# View all branches and tags you have cloned: | |
git branch -r | |
# 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> | |
<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 | |
git-svn 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 class="listingblock"> | |
<div class="content"> | |
<pre><tt># Do the initial import on a server | |
ssh server "cd /pub && git-svn clone http://svn.foo.org/project | |
# Clone locally | |
git clone server:/pub/project | |
# Tell git-svn which branch contains the Subversion commits | |
git update-ref refs/remotes/git-svn origin/master | |
# 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.foo.org/project | |
# Pull the latest changes from Subversion | |
git-svn rebase</tt></pre> | |
</div></div> | |
</div> | |
<h2>REBASE VS. PULL/MERGE</h2> | |
<div class="sectionbody"> | |
<p>Originally, git-svn recommended that the remotes/git-svn branch be | |
pulled or merged from. This is because the author favored | |
<em>git-svn set-tree B</em> to commit a single head rather than the | |
<em>git-svn set-tree A..B</em> notation to commit multiple commits.</p> | |
<p>If you use <em>git-svn set-tree A..B</em> to commit several diffs and you do | |
not have the latest remotes/git-svn merged into my-branch, you should | |
use <em>git-svn rebase</em> to update your work branch instead of <em>git pull</em> or | |
<em>git merge</em>. <em>pull/merge</em> 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> | |
<h2>DESIGN PHILOSOPHY</h2> | |
<div class="sectionbody"> | |
<p>Merge tracking in Subversion is lacking and doing branched development | |
with Subversion is cumbersome as a result. git-svn does not do | |
automated merge/branch tracking by default and leaves it entirely up to | |
the user on the git side. git-svn does however follow copy | |
history of the directory that it is tracking, however (much like | |
how <em>svn log</em> works).</p> | |
</div> | |
<h2>CAVEATS</h2> | |
<div class="sectionbody"> | |
<p>For the sake of simplicity and interoperating with a less-capable system | |
(SVN), it is recommended that all git-svn users clone, fetch and dcommit | |
directly from the SVN server, and avoid all git-clone/pull/merge/push | |
operations between git repositories and branches. The recommended | |
method of exchanging code between git branches and users is | |
git-format-patch and git-am, or just dcommiting to the SVN repository.</p> | |
<p>Running <em>git-merge</em> or <em>git-pull</em> is NOT recommended on a branch you | |
plan to dcommit 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, dcommit may commit to the wrong | |
branch.</p> | |
<p><em>git-clone</em> does not clone branches under the refs/remotes/ hierarchy or | |
any git-svn metadata, or config. So repositories created and managed with | |
using git-svn should use rsync(1) for cloning, if cloning is to be done | |
at all.</p> | |
<p>Since <em>dcommit</em> uses rebase internally, any git branches you git-push to | |
before dcommit on will require forcing an overwrite of the existing ref | |
on the remote repository. This is generally considered bad practice, | |
see the git-push(1) documentation for details.</p> | |
<p>Do not use the --amend option of git-commit(1) on a change you've | |
already dcommitted. It is considered bad practice to --amend commits | |
you've already pushed to a remote repository for other users, and | |
dcommit with SVN is analogous to that.</p> | |
</div> | |
<h2>BUGS</h2> | |
<div class="sectionbody"> | |
<p>We ignore all SVN properties except svn:executable. Any unhandled | |
properties are logged to $GIT_DIR/svn/<refname>/unhandled.log</p> | |
<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> | |
<h2>CONFIGURATION</h2> | |
<div class="sectionbody"> | |
<p>git-svn 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 class="listingblock"> | |
<div class="content"> | |
<pre><tt>[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</tt></pre> | |
</div></div> | |
<p>Keep in mind that the <em><strong></em> (asterisk) wildcard of the local ref | |
(right of the <em>:</em>) *must</strong> be the farthest right path component; | |
however the remote wildcard may be anywhere as long as it's own | |
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 | |
<a href="git-config.html">git-config(1)</a></p> | |
</div> | |
<h2>SEE ALSO</h2> | |
<div class="sectionbody"> | |
<p><a href="git-rebase.html">git-rebase(1)</a></p> | |
</div> | |
<h2>Author</h2> | |
<div class="sectionbody"> | |
<p>Written by Eric Wong <normalperson@yhbt.net>.</p> | |
</div> | |
<h2>Documentation</h2> | |
<div class="sectionbody"> | |
<p>Written by Eric Wong <normalperson@yhbt.net>.</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 29-Aug-2007 07:30:59 UTC | |
</div> | |
</div> | |
</body> | |
</html> |