Autogenerated HTML docs for v1.7.5-rc1
[git/jnareb-git.git] / git-svn.html
blobbddf7bce0e065b8f7451d0535b239c79a2296f6a
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.4.5" />
7 <title>git-svn(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-svn(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-svn -
411 Bidirectional operation between a Subversion repository and git
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="paragraph"><p><em>git svn</em> &lt;command&gt; [options] [arguments]</p></div>
418 </div>
419 <h2 id="_description">DESCRIPTION</h2>
420 <div class="sectionbody">
421 <div class="paragraph"><p><em>git svn</em> is a simple conduit for changesets between Subversion and git.
422 It provides a bidirectional flow of changes between a Subversion and a git
423 repository.</p></div>
424 <div class="paragraph"><p><em>git svn</em> can track a standard Subversion repository,
425 following the common "trunk/branches/tags" layout, with the --stdlayout option.
426 It can also follow branches and tags in any layout with the -T/-t/-b options
427 (see options to <em>init</em> below, and also the <em>clone</em> command).</p></div>
428 <div class="paragraph"><p>Once tracking a Subversion repository (with any of the above methods), the git
429 repository can be updated from Subversion by the <em>fetch</em> command and
430 Subversion updated from git by the <em>dcommit</em> command.</p></div>
431 </div>
432 <h2 id="_commands">COMMANDS</h2>
433 <div class="sectionbody">
434 <div class="dlist"><dl>
435 <dt class="hdlist1">
436 <em>init</em>
437 </dt>
438 <dd>
440 Initializes an empty git repository with additional
441 metadata directories for <em>git svn</em>. The Subversion URL
442 may be specified as a command-line argument, or as full
443 URL arguments to -T/-t/-b. Optionally, the target
444 directory to operate on can be specified as a second
445 argument. Normally this command initializes the current
446 directory.
447 </p>
448 <div class="dlist"><dl>
449 <dt class="hdlist1">
450 -T&lt;trunk_subdir&gt;
451 </dt>
452 <dt class="hdlist1">
453 --trunk=&lt;trunk_subdir&gt;
454 </dt>
455 <dt class="hdlist1">
456 -t&lt;tags_subdir&gt;
457 </dt>
458 <dt class="hdlist1">
459 --tags=&lt;tags_subdir&gt;
460 </dt>
461 <dt class="hdlist1">
462 -b&lt;branches_subdir&gt;
463 </dt>
464 <dt class="hdlist1">
465 --branches=&lt;branches_subdir&gt;
466 </dt>
467 <dt class="hdlist1">
469 </dt>
470 <dt class="hdlist1">
471 --stdlayout
472 </dt>
473 <dd>
475 These are optional command-line options for init. Each of
476 these flags can point to a relative repository path
477 (--tags=project/tags) or a full url
478 (--tags=https://foo.org/project/tags).
479 You can specify more than one --tags and/or --branches options, in case
480 your Subversion repository places tags or branches under multiple paths.
481 The option --stdlayout is
482 a shorthand way of setting trunk,tags,branches as the relative paths,
483 which is the Subversion default. If any of the other options are given
484 as well, they take precedence.
485 </p>
486 </dd>
487 <dt class="hdlist1">
488 --no-metadata
489 </dt>
490 <dd>
492 Set the <em>noMetadata</em> option in the [svn-remote] config.
493 This option is not recommended, please read the <em>svn.noMetadata</em>
494 section of this manpage before using this option.
495 </p>
496 </dd>
497 <dt class="hdlist1">
498 --use-svm-props
499 </dt>
500 <dd>
502 Set the <em>useSvmProps</em> option in the [svn-remote] config.
503 </p>
504 </dd>
505 <dt class="hdlist1">
506 --use-svnsync-props
507 </dt>
508 <dd>
510 Set the <em>useSvnsyncProps</em> option in the [svn-remote] config.
511 </p>
512 </dd>
513 <dt class="hdlist1">
514 --rewrite-root=&lt;URL&gt;
515 </dt>
516 <dd>
518 Set the <em>rewriteRoot</em> option in the [svn-remote] config.
519 </p>
520 </dd>
521 <dt class="hdlist1">
522 --rewrite-uuid=&lt;UUID&gt;
523 </dt>
524 <dd>
526 Set the <em>rewriteUUID</em> option in the [svn-remote] config.
527 </p>
528 </dd>
529 <dt class="hdlist1">
530 --username=&lt;user&gt;
531 </dt>
532 <dd>
534 For transports that SVN handles authentication for (http,
535 https, and plain svn), specify the username. For other
536 transports (eg svn+ssh://), you must include the username in
537 the URL, eg svn+ssh://foo@svn.bar.com/project
538 </p>
539 </dd>
540 <dt class="hdlist1">
541 --prefix=&lt;prefix&gt;
542 </dt>
543 <dd>
545 This allows one to specify a prefix which is prepended
546 to the names of remotes if trunk/branches/tags are
547 specified. The prefix does not automatically include a
548 trailing slash, so be sure you include one in the
549 argument if that is what you want. If --branches/-b is
550 specified, the prefix must include a trailing slash.
551 Setting a prefix is useful if you wish to track multiple
552 projects that share a common repository.
553 </p>
554 </dd>
555 <dt class="hdlist1">
556 --ignore-paths=&lt;regex&gt;
557 </dt>
558 <dd>
560 When passed to <em>init</em> or <em>clone</em> this regular expression will
561 be preserved as a config key. See <em>fetch</em> for a description
562 of <em>--ignore-paths</em>.
563 </p>
564 </dd>
565 <dt class="hdlist1">
566 --no-minimize-url
567 </dt>
568 <dd>
570 When tracking multiple directories (using --stdlayout,
571 --branches, or --tags options), git svn will attempt to connect
572 to the root (or highest allowed level) of the Subversion
573 repository. This default allows better tracking of history if
574 entire projects are moved within a repository, but may cause
575 issues on repositories where read access restrictions are in
576 place. Passing <em>--no-minimize-url</em> will allow git svn to
577 accept URLs as-is without attempting to connect to a higher
578 level directory. This option is off by default when only
579 one URL/branch is tracked (it would do little good).
580 </p>
581 </dd>
582 </dl></div>
583 </dd>
584 <dt class="hdlist1">
585 <em>fetch</em>
586 </dt>
587 <dd>
589 Fetch unfetched revisions from the Subversion remote we are
590 tracking. The name of the [svn-remote "&#8230;"] section in the
591 .git/config file may be specified as an optional command-line
592 argument.
593 </p>
594 <div class="dlist"><dl>
595 <dt class="hdlist1">
596 --localtime
597 </dt>
598 <dd>
600 Store Git commit times in the local timezone instead of UTC. This
601 makes <em>git log</em> (even without --date=local) show the same times
602 that <tt>svn log</tt> would in the local timezone.
603 </p>
604 <div class="paragraph"><p>This doesn&#8217;t interfere with interoperating with the Subversion
605 repository you cloned from, but if you wish for your local Git
606 repository to be able to interoperate with someone else&#8217;s local Git
607 repository, either don&#8217;t use this option or you should both use it in
608 the same local timezone.</p></div>
609 </dd>
610 <dt class="hdlist1">
611 --parent
612 </dt>
613 <dd>
615 Fetch only from the SVN parent of the current HEAD.
616 </p>
617 </dd>
618 <dt class="hdlist1">
619 --ignore-paths=&lt;regex&gt;
620 </dt>
621 <dd>
623 This allows one to specify a Perl regular expression that will
624 cause skipping of all matching paths from checkout from SVN.
625 The <em>--ignore-paths</em> option should match for every <em>fetch</em>
626 (including automatic fetches due to <em>clone</em>, <em>dcommit</em>,
627 <em>rebase</em>, etc) on a given repository.
628 </p>
629 <div class="verseblock">
630 <div class="verseblock-content">config key: svn-remote.&lt;name&gt;.ignore-paths</div>
631 <div class="verseblock-attribution">
632 </div></div>
633 <div class="paragraph"><p>If the ignore-paths config key is set and the command line option is
634 also given, both regular expressions will be used.</p></div>
635 <div class="paragraph"><p>Examples:</p></div>
636 <div class="dlist"><dl>
637 <dt class="hdlist1">
638 Skip "doc*" directory for every fetch
639 </dt>
640 <dd>
641 <div class="listingblock">
642 <div class="content">
643 <pre><tt>--ignore-paths="^doc"</tt></pre>
644 </div></div>
645 </dd>
646 <dt class="hdlist1">
647 Skip "branches" and "tags" of first level directories
648 </dt>
649 <dd>
650 <div class="listingblock">
651 <div class="content">
652 <pre><tt>--ignore-paths="^[^/]+/(?:branches|tags)"</tt></pre>
653 </div></div>
654 </dd>
655 </dl></div>
656 </dd>
657 <dt class="hdlist1">
658 --use-log-author
659 </dt>
660 <dd>
662 When retrieving svn commits into git (as part of fetch, rebase, or
663 dcommit operations), look for the first From: or Signed-off-by: line
664 in the log message and use that as the author string.
665 </p>
666 </dd>
667 <dt class="hdlist1">
668 --add-author-from
669 </dt>
670 <dd>
672 When committing to svn from git (as part of commit or dcommit
673 operations), if the existing log message doesn&#8217;t already have a
674 From: or Signed-off-by: line, append a From: line based on the
675 git commit&#8217;s author string. If you use this, then --use-log-author
676 will retrieve a valid author string for all commits.
677 </p>
678 </dd>
679 </dl></div>
680 </dd>
681 <dt class="hdlist1">
682 <em>clone</em>
683 </dt>
684 <dd>
686 Runs <em>init</em> and <em>fetch</em>. It will automatically create a
687 directory based on the basename of the URL passed to it;
688 or if a second argument is passed; it will create a directory
689 and work within that. It accepts all arguments that the
690 <em>init</em> and <em>fetch</em> commands accept; with the exception of
691 <em>--fetch-all</em> and <em>--parent</em>. After a repository is cloned,
692 the <em>fetch</em> command will be able to update revisions without
693 affecting the working tree; and the <em>rebase</em> command will be
694 able to update the working tree with the latest changes.
695 </p>
696 </dd>
697 <dt class="hdlist1">
698 <em>rebase</em>
699 </dt>
700 <dd>
702 This fetches revisions from the SVN parent of the current HEAD
703 and rebases the current (uncommitted to SVN) work against it.
704 </p>
705 <div class="paragraph"><p>This works similarly to <tt>svn update</tt> or <em>git pull</em> except that
706 it preserves linear history with <em>git rebase</em> instead of
707 <em>git merge</em> for ease of dcommitting with <em>git svn</em>.</p></div>
708 <div class="paragraph"><p>This accepts all options that <em>git svn fetch</em> and <em>git rebase</em>
709 accept. However, <em>--fetch-all</em> only fetches from the current
710 [svn-remote], and not all [svn-remote] definitions.</p></div>
711 <div class="paragraph"><p>Like <em>git rebase</em>; this requires that the working tree be clean
712 and have no uncommitted changes.</p></div>
713 <div class="dlist"><dl>
714 <dt class="hdlist1">
716 </dt>
717 <dt class="hdlist1">
718 --local
719 </dt>
720 <dd>
722 Do not fetch remotely; only run <em>git rebase</em> against the
723 last fetched commit from the upstream SVN.
724 </p>
725 </dd>
726 </dl></div>
727 </dd>
728 <dt class="hdlist1">
729 <em>dcommit</em>
730 </dt>
731 <dd>
733 Commit each diff from a specified head directly to the SVN
734 repository, and then rebase or reset (depending on whether or
735 not there is a diff between SVN and head). This will create
736 a revision in SVN for each commit in git.
737 It is recommended that you run <em>git svn</em> fetch and rebase (not
738 pull or merge) your commits against the latest changes in the
739 SVN repository.
740 An optional revision or branch argument may be specified, and
741 causes <em>git svn</em> to do all work on that revision/branch
742 instead of HEAD.
743 This is advantageous over <em>set-tree</em> (below) because it produces
744 cleaner, more linear history.
745 </p>
746 <div class="dlist"><dl>
747 <dt class="hdlist1">
748 --no-rebase
749 </dt>
750 <dd>
752 After committing, do not rebase or reset.
753 </p>
754 </dd>
755 <dt class="hdlist1">
756 --commit-url &lt;URL&gt;
757 </dt>
758 <dd>
760 Commit to this SVN URL (the full path). This is intended to
761 allow existing <em>git svn</em> repositories created with one transport
762 method (e.g. <tt>svn://</tt> or <tt>http://</tt> for anonymous read) to be
763 reused if a user is later given access to an alternate transport
764 method (e.g. <tt>svn+ssh://</tt> or <tt>https://</tt>) for commit.
765 </p>
766 <div class="verseblock">
767 <div class="verseblock-content">config key: svn-remote.&lt;name&gt;.commiturl
768 config key: svn.commiturl (overwrites all svn-remote.&lt;name&gt;.commiturl options)</div>
769 <div class="verseblock-attribution">
770 </div></div>
771 <div class="paragraph"><p>Using this option for any other purpose (don&#8217;t ask) is very strongly
772 discouraged.</p></div>
773 </dd>
774 </dl></div>
775 </dd>
776 <dt class="hdlist1">
777 <em>branch</em>
778 </dt>
779 <dd>
781 Create a branch in the SVN repository.
782 </p>
783 <div class="dlist"><dl>
784 <dt class="hdlist1">
786 </dt>
787 <dt class="hdlist1">
788 --message
789 </dt>
790 <dd>
792 Allows to specify the commit message.
793 </p>
794 </dd>
795 <dt class="hdlist1">
797 </dt>
798 <dt class="hdlist1">
799 --tag
800 </dt>
801 <dd>
803 Create a tag by using the tags_subdir instead of the branches_subdir
804 specified during git svn init.
805 </p>
806 </dd>
807 <dt class="hdlist1">
809 </dt>
810 <dt class="hdlist1">
811 --destination
812 </dt>
813 <dd>
815 If more than one --branches (or --tags) option was given to the <em>init</em>
816 or <em>clone</em> command, you must provide the location of the branch (or
817 tag) you wish to create in the SVN repository. The value of this
818 option must match one of the paths specified by a --branches (or
819 --tags) option. You can see these paths with the commands
820 </p>
821 <div class="literalblock">
822 <div class="content">
823 <pre><tt>git config --get-all svn-remote.&lt;name&gt;.branches
824 git config --get-all svn-remote.&lt;name&gt;.tags</tt></pre>
825 </div></div>
826 <div class="paragraph"><p>where &lt;name&gt; is the name of the SVN repository as specified by the -R option to
827 <em>init</em> (or "svn" by default).</p></div>
828 </dd>
829 <dt class="hdlist1">
830 --username
831 </dt>
832 <dd>
834 Specify the SVN username to perform the commit as. This option overrides
835 the <em>username</em> configuration property.
836 </p>
837 </dd>
838 <dt class="hdlist1">
839 --commit-url
840 </dt>
841 <dd>
843 Use the specified URL to connect to the destination Subversion
844 repository. This is useful in cases where the source SVN
845 repository is read-only. This option overrides configuration
846 property <em>commiturl</em>.
847 </p>
848 <div class="literalblock">
849 <div class="content">
850 <pre><tt>git config --get-all svn-remote.&lt;name&gt;.commiturl</tt></pre>
851 </div></div>
852 </dd>
853 </dl></div>
854 </dd>
855 <dt class="hdlist1">
856 <em>tag</em>
857 </dt>
858 <dd>
860 Create a tag in the SVN repository. This is a shorthand for
861 <em>branch -t</em>.
862 </p>
863 </dd>
864 <dt class="hdlist1">
865 <em>log</em>
866 </dt>
867 <dd>
869 This should make it easy to look up svn log messages when svn
870 users refer to -r/--revision numbers.
871 </p>
872 <div class="paragraph"><p>The following features from &#8216;svn log&#8217; are supported:</p></div>
873 <div class="dlist"><dl>
874 <dt class="hdlist1">
875 -r &lt;n&gt;[:&lt;n&gt;]
876 </dt>
877 <dt class="hdlist1">
878 --revision=&lt;n&gt;[:&lt;n&gt;]
879 </dt>
880 <dd>
882 is supported, non-numeric args are not:
883 HEAD, NEXT, BASE, PREV, etc &#8230;
884 </p>
885 </dd>
886 <dt class="hdlist1">
888 </dt>
889 <dt class="hdlist1">
890 --verbose
891 </dt>
892 <dd>
894 it&#8217;s not completely compatible with the --verbose
895 output in svn log, but reasonably close.
896 </p>
897 </dd>
898 <dt class="hdlist1">
899 --limit=&lt;n&gt;
900 </dt>
901 <dd>
903 is NOT the same as --max-count, doesn&#8217;t count
904 merged/excluded commits
905 </p>
906 </dd>
907 <dt class="hdlist1">
908 --incremental
909 </dt>
910 <dd>
912 supported
913 </p>
914 </dd>
915 </dl></div>
916 <div class="paragraph"><p>New features:</p></div>
917 <div class="dlist"><dl>
918 <dt class="hdlist1">
919 --show-commit
920 </dt>
921 <dd>
923 shows the git commit sha1, as well
924 </p>
925 </dd>
926 <dt class="hdlist1">
927 --oneline
928 </dt>
929 <dd>
931 our version of --pretty=oneline
932 </p>
933 </dd>
934 </dl></div>
935 <div class="admonitionblock">
936 <table><tr>
937 <td class="icon">
938 <div class="title">Note</div>
939 </td>
940 <td class="content">SVN itself only stores times in UTC and nothing else. The regular svn
941 client converts the UTC time to the local time (or based on the TZ=
942 environment). This command has the same behaviour.</td>
943 </tr></table>
944 </div>
945 <div class="paragraph"><p>Any other arguments are passed directly to <em>git log</em></p></div>
946 </dd>
947 <dt class="hdlist1">
948 <em>blame</em>
949 </dt>
950 <dd>
952 Show what revision and author last modified each line of a file. The
953 output of this mode is format-compatible with the output of
954 &#8216;svn blame&#8217; by default. Like the SVN blame command,
955 local uncommitted changes in the working copy are ignored;
956 the version of the file in the HEAD revision is annotated. Unknown
957 arguments are passed directly to <em>git blame</em>.
958 </p>
959 <div class="dlist"><dl>
960 <dt class="hdlist1">
961 --git-format
962 </dt>
963 <dd>
965 Produce output in the same format as <em>git blame</em>, but with
966 SVN revision numbers instead of git commit hashes. In this mode,
967 changes that haven&#8217;t been committed to SVN (including local
968 working-copy edits) are shown as revision 0.
969 </p>
970 </dd>
971 </dl></div>
972 </dd>
973 <dt class="hdlist1">
974 <em>find-rev</em>
975 </dt>
976 <dd>
978 When given an SVN revision number of the form <em>rN</em>, returns the
979 corresponding git commit hash (this can optionally be followed by a
980 tree-ish to specify which branch should be searched). When given a
981 tree-ish, returns the corresponding SVN revision number.
982 </p>
983 </dd>
984 <dt class="hdlist1">
985 <em>set-tree</em>
986 </dt>
987 <dd>
989 You should consider using <em>dcommit</em> instead of this command.
990 Commit specified commit or tree objects to SVN. This relies on
991 your imported fetch data being up-to-date. This makes
992 absolutely no attempts to do patching when committing to SVN, it
993 simply overwrites files with those specified in the tree or
994 commit. All merging is assumed to have taken place
995 independently of <em>git svn</em> functions.
996 </p>
997 </dd>
998 <dt class="hdlist1">
999 <em>create-ignore</em>
1000 </dt>
1001 <dd>
1003 Recursively finds the svn:ignore property on directories and
1004 creates matching .gitignore files. The resulting files are staged to
1005 be committed, but are not committed. Use -r/--revision to refer to a
1006 specific revision.
1007 </p>
1008 </dd>
1009 <dt class="hdlist1">
1010 <em>show-ignore</em>
1011 </dt>
1012 <dd>
1014 Recursively finds and lists the svn:ignore property on
1015 directories. The output is suitable for appending to
1016 the $GIT_DIR/info/exclude file.
1017 </p>
1018 </dd>
1019 <dt class="hdlist1">
1020 <em>mkdirs</em>
1021 </dt>
1022 <dd>
1024 Attempts to recreate empty directories that core git cannot track
1025 based on information in $GIT_DIR/svn/&lt;refname&gt;/unhandled.log files.
1026 Empty directories are automatically recreated when using
1027 "git svn clone" and "git svn rebase", so "mkdirs" is intended
1028 for use after commands like "git checkout" or "git reset".
1029 </p>
1030 </dd>
1031 <dt class="hdlist1">
1032 <em>commit-diff</em>
1033 </dt>
1034 <dd>
1036 Commits the diff of two tree-ish arguments from the
1037 command-line. This command does not rely on being inside an <tt>git svn
1038 init</tt>-ed repository. This command takes three arguments, (a) the
1039 original tree to diff against, (b) the new tree result, (c) the
1040 URL of the target Subversion repository. The final argument
1041 (URL) may be omitted if you are working from a <em>git svn</em>-aware
1042 repository (that has been <tt>init</tt>-ed with <em>git svn</em>).
1043 The -r&lt;revision&gt; option is required for this.
1044 </p>
1045 </dd>
1046 <dt class="hdlist1">
1047 <em>info</em>
1048 </dt>
1049 <dd>
1051 Shows information about a file or directory similar to what
1052 &#8216;svn info&#8217; provides. Does not currently support a -r/--revision
1053 argument. Use the --url option to output only the value of the
1054 <em>URL:</em> field.
1055 </p>
1056 </dd>
1057 <dt class="hdlist1">
1058 <em>proplist</em>
1059 </dt>
1060 <dd>
1062 Lists the properties stored in the Subversion repository about a
1063 given file or directory. Use -r/--revision to refer to a specific
1064 Subversion revision.
1065 </p>
1066 </dd>
1067 <dt class="hdlist1">
1068 <em>propget</em>
1069 </dt>
1070 <dd>
1072 Gets the Subversion property given as the first argument, for a
1073 file. A specific revision can be specified with -r/--revision.
1074 </p>
1075 </dd>
1076 <dt class="hdlist1">
1077 <em>show-externals</em>
1078 </dt>
1079 <dd>
1081 Shows the Subversion externals. Use -r/--revision to specify a
1082 specific revision.
1083 </p>
1084 </dd>
1085 <dt class="hdlist1">
1086 <em>gc</em>
1087 </dt>
1088 <dd>
1090 Compress $GIT_DIR/svn/&lt;refname&gt;/unhandled.log files in .git/svn
1091 and remove $GIT_DIR/svn/&lt;refname&gt;index files in .git/svn.
1092 </p>
1093 </dd>
1094 <dt class="hdlist1">
1095 <em>reset</em>
1096 </dt>
1097 <dd>
1099 Undoes the effects of <em>fetch</em> back to the specified revision.
1100 This allows you to re-<em>fetch</em> an SVN revision. Normally the
1101 contents of an SVN revision should never change and <em>reset</em>
1102 should not be necessary. However, if SVN permissions change,
1103 or if you alter your --ignore-paths option, a <em>fetch</em> may fail
1104 with "not found in commit" (file not previously visible) or
1105 "checksum mismatch" (missed a modification). If the problem
1106 file cannot be ignored forever (with --ignore-paths) the only
1107 way to repair the repo is to use <em>reset</em>.
1108 </p>
1109 <div class="paragraph"><p>Only the rev_map and refs/remotes/git-svn are changed. Follow <em>reset</em>
1110 with a <em>fetch</em> and then <em>git reset</em> or <em>git rebase</em> to move local
1111 branches onto the new tree.</p></div>
1112 <div class="dlist"><dl>
1113 <dt class="hdlist1">
1114 -r &lt;n&gt;
1115 </dt>
1116 <dt class="hdlist1">
1117 --revision=&lt;n&gt;
1118 </dt>
1119 <dd>
1121 Specify the most recent revision to keep. All later revisions
1122 are discarded.
1123 </p>
1124 </dd>
1125 <dt class="hdlist1">
1127 </dt>
1128 <dt class="hdlist1">
1129 --parent
1130 </dt>
1131 <dd>
1133 Discard the specified revision as well, keeping the nearest
1134 parent instead.
1135 </p>
1136 </dd>
1137 <dt class="hdlist1">
1138 Example:
1139 </dt>
1140 <dd>
1142 Assume you have local changes in "master", but you need to refetch "r2".
1143 </p>
1144 <div class="listingblock">
1145 <div class="content">
1146 <pre><tt> r1---r2---r3 remotes/git-svn
1148 A---B master</tt></pre>
1149 </div></div>
1150 <div class="paragraph"><p>Fix the ignore-paths or SVN permissions problem that caused "r2" to
1151 be incomplete in the first place. Then:</p></div>
1152 <div class="verseblock">
1153 <div class="verseblock-content">git svn reset -r2 -p
1154 git svn fetch</div>
1155 <div class="verseblock-attribution">
1156 </div></div>
1157 <div class="listingblock">
1158 <div class="content">
1159 <pre><tt> r1---r2'--r3' remotes/git-svn
1161 r2---r3---A---B master</tt></pre>
1162 </div></div>
1163 <div class="paragraph"><p>Then fixup "master" with <em>git rebase</em>.
1164 Do NOT use <em>git merge</em> or your history will not be compatible with a
1165 future <em>dcommit</em>!</p></div>
1166 <div class="verseblock">
1167 <div class="verseblock-content">git rebase --onto remotes/git-svn A^ master</div>
1168 <div class="verseblock-attribution">
1169 </div></div>
1170 <div class="listingblock">
1171 <div class="content">
1172 <pre><tt> r1---r2'--r3' remotes/git-svn
1174 A'--B' master</tt></pre>
1175 </div></div>
1176 </dd>
1177 </dl></div>
1178 </dd>
1179 </dl></div>
1180 </div>
1181 <h2 id="_options">OPTIONS</h2>
1182 <div class="sectionbody">
1183 <div class="dlist"><dl>
1184 <dt class="hdlist1">
1185 --shared[=(false|true|umask|group|all|world|everybody)]
1186 </dt>
1187 <dt class="hdlist1">
1188 --template=&lt;template_directory&gt;
1189 </dt>
1190 <dd>
1192 Only used with the <em>init</em> command.
1193 These are passed directly to <em>git init</em>.
1194 </p>
1195 </dd>
1196 <dt class="hdlist1">
1197 -r &lt;arg&gt;
1198 </dt>
1199 <dt class="hdlist1">
1200 --revision &lt;arg&gt;
1201 </dt>
1202 <dd>
1204 Used with the <em>fetch</em> command.
1205 </p>
1206 <div class="paragraph"><p>This allows revision ranges for partial/cauterized history
1207 to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
1208 $NUMBER:HEAD, and BASE:$NUMBER are all supported.</p></div>
1209 <div class="paragraph"><p>This can allow you to make partial mirrors when running fetch;
1210 but is generally not recommended because history will be skipped
1211 and lost.</p></div>
1212 </dd>
1213 <dt class="hdlist1">
1215 </dt>
1216 <dt class="hdlist1">
1217 --stdin
1218 </dt>
1219 <dd>
1221 Only used with the <em>set-tree</em> command.
1222 </p>
1223 <div class="paragraph"><p>Read a list of commits from stdin and commit them in reverse
1224 order. Only the leading sha1 is read from each line, so
1225 <em>git rev-list --pretty=oneline</em> output can be used.</p></div>
1226 </dd>
1227 <dt class="hdlist1">
1228 --rmdir
1229 </dt>
1230 <dd>
1232 Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands.
1233 </p>
1234 <div class="paragraph"><p>Remove directories from the SVN tree if there are no files left
1235 behind. SVN can version empty directories, and they are not
1236 removed by default if there are no files left in them. git
1237 cannot version empty directories. Enabling this flag will make
1238 the commit to SVN act like git.</p></div>
1239 <div class="verseblock">
1240 <div class="verseblock-content">config key: svn.rmdir</div>
1241 <div class="verseblock-attribution">
1242 </div></div>
1243 </dd>
1244 <dt class="hdlist1">
1246 </dt>
1247 <dt class="hdlist1">
1248 --edit
1249 </dt>
1250 <dd>
1252 Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands.
1253 </p>
1254 <div class="paragraph"><p>Edit the commit message before committing to SVN. This is off by
1255 default for objects that are commits, and forced on when committing
1256 tree objects.</p></div>
1257 <div class="verseblock">
1258 <div class="verseblock-content">config key: svn.edit</div>
1259 <div class="verseblock-attribution">
1260 </div></div>
1261 </dd>
1262 <dt class="hdlist1">
1263 -l&lt;num&gt;
1264 </dt>
1265 <dt class="hdlist1">
1266 --find-copies-harder
1267 </dt>
1268 <dd>
1270 Only used with the <em>dcommit</em>, <em>set-tree</em> and <em>commit-diff</em> commands.
1271 </p>
1272 <div class="paragraph"><p>They are both passed directly to <em>git diff-tree</em>; see
1273 <a href="git-diff-tree.html">git-diff-tree(1)</a> for more information.</p></div>
1274 <div class="verseblock">
1275 <div class="verseblock-content">config key: svn.l
1276 config key: svn.findcopiesharder</div>
1277 <div class="verseblock-attribution">
1278 </div></div>
1279 </dd>
1280 <dt class="hdlist1">
1281 -A&lt;filename&gt;
1282 </dt>
1283 <dt class="hdlist1">
1284 --authors-file=&lt;filename&gt;
1285 </dt>
1286 <dd>
1288 Syntax is compatible with the file used by <em>git cvsimport</em>:
1289 </p>
1290 <div class="listingblock">
1291 <div class="content">
1292 <pre><tt> loginname = Joe User &lt;user@example.com&gt;</tt></pre>
1293 </div></div>
1294 <div class="paragraph"><p>If this option is specified and <em>git svn</em> encounters an SVN
1295 committer name that does not exist in the authors-file, <em>git svn</em>
1296 will abort operation. The user will then have to add the
1297 appropriate entry. Re-running the previous <em>git svn</em> command
1298 after the authors-file is modified should continue operation.</p></div>
1299 <div class="verseblock">
1300 <div class="verseblock-content">config key: svn.authorsfile</div>
1301 <div class="verseblock-attribution">
1302 </div></div>
1303 </dd>
1304 <dt class="hdlist1">
1305 --authors-prog=&lt;filename&gt;
1306 </dt>
1307 <dd>
1309 If this option is specified, for each SVN committer name that
1310 does not exist in the authors file, the given file is executed
1311 with the committer name as the first argument. The program is
1312 expected to return a single line of the form "Name &lt;email&gt;",
1313 which will be treated as if included in the authors file.
1314 </p>
1315 </dd>
1316 <dt class="hdlist1">
1318 </dt>
1319 <dt class="hdlist1">
1320 --quiet
1321 </dt>
1322 <dd>
1324 Make <em>git svn</em> less verbose. Specify a second time to make it
1325 even less verbose.
1326 </p>
1327 </dd>
1328 <dt class="hdlist1">
1329 --repack[=&lt;n&gt;]
1330 </dt>
1331 <dt class="hdlist1">
1332 --repack-flags=&lt;flags&gt;
1333 </dt>
1334 <dd>
1336 These should help keep disk usage sane for large fetches with
1337 many revisions.
1338 </p>
1339 <div class="paragraph"><p>--repack takes an optional argument for the number of revisions
1340 to fetch before repacking. This defaults to repacking every
1341 1000 commits fetched if no argument is specified.</p></div>
1342 <div class="paragraph"><p>--repack-flags are passed directly to <em>git repack</em>.</p></div>
1343 <div class="verseblock">
1344 <div class="verseblock-content">config key: svn.repack
1345 config key: svn.repackflags</div>
1346 <div class="verseblock-attribution">
1347 </div></div>
1348 </dd>
1349 <dt class="hdlist1">
1351 </dt>
1352 <dt class="hdlist1">
1353 --merge
1354 </dt>
1355 <dt class="hdlist1">
1356 -s&lt;strategy&gt;
1357 </dt>
1358 <dt class="hdlist1">
1359 --strategy=&lt;strategy&gt;
1360 </dt>
1361 <dd>
1363 These are only used with the <em>dcommit</em> and <em>rebase</em> commands.
1364 </p>
1365 <div class="paragraph"><p>Passed directly to <em>git rebase</em> when using <em>dcommit</em> if a
1366 <em>git reset</em> cannot be used (see <em>dcommit</em>).</p></div>
1367 </dd>
1368 <dt class="hdlist1">
1370 </dt>
1371 <dt class="hdlist1">
1372 --dry-run
1373 </dt>
1374 <dd>
1376 This can be used with the <em>dcommit</em>, <em>rebase</em>, <em>branch</em> and
1377 <em>tag</em> commands.
1378 </p>
1379 <div class="paragraph"><p>For <em>dcommit</em>, print out the series of git arguments that would show
1380 which diffs would be committed to SVN.</p></div>
1381 <div class="paragraph"><p>For <em>rebase</em>, display the local branch associated with the upstream svn
1382 repository associated with the current branch and the URL of svn
1383 repository that will be fetched from.</p></div>
1384 <div class="paragraph"><p>For <em>branch</em> and <em>tag</em>, display the urls that will be used for copying when
1385 creating the branch or tag.</p></div>
1386 </dd>
1387 </dl></div>
1388 </div>
1389 <h2 id="_advanced_options">ADVANCED OPTIONS</h2>
1390 <div class="sectionbody">
1391 <div class="dlist"><dl>
1392 <dt class="hdlist1">
1393 -i&lt;GIT_SVN_ID&gt;
1394 </dt>
1395 <dt class="hdlist1">
1396 --id &lt;GIT_SVN_ID&gt;
1397 </dt>
1398 <dd>
1400 This sets GIT_SVN_ID (instead of using the environment). This
1401 allows the user to override the default refname to fetch from
1402 when tracking a single URL. The <em>log</em> and <em>dcommit</em> commands
1403 no longer require this switch as an argument.
1404 </p>
1405 </dd>
1406 <dt class="hdlist1">
1407 -R&lt;remote name&gt;
1408 </dt>
1409 <dt class="hdlist1">
1410 --svn-remote &lt;remote name&gt;
1411 </dt>
1412 <dd>
1414 Specify the [svn-remote "&lt;remote name&gt;"] section to use,
1415 this allows SVN multiple repositories to be tracked.
1416 Default: "svn"
1417 </p>
1418 </dd>
1419 <dt class="hdlist1">
1420 --follow-parent
1421 </dt>
1422 <dd>
1424 This is especially helpful when we&#8217;re tracking a directory
1425 that has been moved around within the repository, or if we
1426 started tracking a branch and never tracked the trunk it was
1427 descended from. This feature is enabled by default, use
1428 --no-follow-parent to disable it.
1429 </p>
1430 <div class="verseblock">
1431 <div class="verseblock-content">config key: svn.followparent</div>
1432 <div class="verseblock-attribution">
1433 </div></div>
1434 </dd>
1435 </dl></div>
1436 </div>
1437 <h2 id="_config_file_only_options">CONFIG FILE-ONLY OPTIONS</h2>
1438 <div class="sectionbody">
1439 <div class="dlist"><dl>
1440 <dt class="hdlist1">
1441 svn.noMetadata
1442 </dt>
1443 <dt class="hdlist1">
1444 svn-remote.&lt;name&gt;.noMetadata
1445 </dt>
1446 <dd>
1448 This gets rid of the <em>git-svn-id:</em> lines at the end of every commit.
1449 </p>
1450 <div class="paragraph"><p>This option can only be used for one-shot imports as <em>git svn</em>
1451 will not be able to fetch again without metadata. Additionally,
1452 if you lose your .git/svn/<strong>*/.rev_map.</strong> files, <em>git svn</em> will not
1453 be able to rebuild them.</p></div>
1454 <div class="paragraph"><p>The <em>git svn log</em> command will not work on repositories using
1455 this, either. Using this conflicts with the <em>useSvmProps</em>
1456 option for (hopefully) obvious reasons.</p></div>
1457 <div class="paragraph"><p>This option is NOT recommended as it makes it difficult to track down
1458 old references to SVN revision numbers in existing documentation, bug
1459 reports and archives. If you plan to eventually migrate from SVN to git
1460 and are certain about dropping SVN history, consider
1461 <a href="git-filter-branch.html">git-filter-branch(1)</a> instead. filter-branch also allows
1462 reformatting of metadata for ease-of-reading and rewriting authorship
1463 info for non-"svn.authorsFile" users.</p></div>
1464 </dd>
1465 <dt class="hdlist1">
1466 svn.useSvmProps
1467 </dt>
1468 <dt class="hdlist1">
1469 svn-remote.&lt;name&gt;.useSvmProps
1470 </dt>
1471 <dd>
1473 This allows <em>git svn</em> to re-map repository URLs and UUIDs from
1474 mirrors created using SVN::Mirror (or svk) for metadata.
1475 </p>
1476 <div class="paragraph"><p>If an SVN revision has a property, "svm:headrev", it is likely
1477 that the revision was created by SVN::Mirror (also used by SVK).
1478 The property contains a repository UUID and a revision. We want
1479 to make it look like we are mirroring the original URL, so
1480 introduce a helper function that returns the original identity
1481 URL and UUID, and use it when generating metadata in commit
1482 messages.</p></div>
1483 </dd>
1484 <dt class="hdlist1">
1485 svn.useSvnsyncProps
1486 </dt>
1487 <dt class="hdlist1">
1488 svn-remote.&lt;name&gt;.useSvnsyncprops
1489 </dt>
1490 <dd>
1492 Similar to the useSvmProps option; this is for users
1493 of the svnsync(1) command distributed with SVN 1.4.x and
1494 later.
1495 </p>
1496 </dd>
1497 <dt class="hdlist1">
1498 svn-remote.&lt;name&gt;.rewriteRoot
1499 </dt>
1500 <dd>
1502 This allows users to create repositories from alternate
1503 URLs. For example, an administrator could run <em>git svn</em> on the
1504 server locally (accessing via file://) but wish to distribute
1505 the repository with a public http:// or svn:// URL in the
1506 metadata so users of it will see the public URL.
1507 </p>
1508 </dd>
1509 <dt class="hdlist1">
1510 svn-remote.&lt;name&gt;.rewriteUUID
1511 </dt>
1512 <dd>
1514 Similar to the useSvmProps option; this is for users who need
1515 to remap the UUID manually. This may be useful in situations
1516 where the original UUID is not available via either useSvmProps
1517 or useSvnsyncProps.
1518 </p>
1519 </dd>
1520 <dt class="hdlist1">
1521 svn.brokenSymlinkWorkaround
1522 </dt>
1523 <dd>
1525 This disables potentially expensive checks to workaround
1526 broken symlinks checked into SVN by broken clients. Set this
1527 option to "false" if you track a SVN repository with many
1528 empty blobs that are not symlinks. This option may be changed
1529 while <em>git svn</em> is running and take effect on the next
1530 revision fetched. If unset, <em>git svn</em> assumes this option to
1531 be "true".
1532 </p>
1533 </dd>
1534 <dt class="hdlist1">
1535 svn.pathnameencoding
1536 </dt>
1537 <dd>
1539 This instructs git svn to recode pathnames to a given encoding.
1540 It can be used by windows users and by those who work in non-utf8
1541 locales to avoid corrupted file names with non-ASCII characters.
1542 Valid encodings are the ones supported by Perl&#8217;s Encode module.
1543 </p>
1544 </dd>
1545 </dl></div>
1546 <div class="paragraph"><p>Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
1547 options all affect the metadata generated and used by <em>git svn</em>; they
1548 <strong>must</strong> be set in the configuration file before any history is imported
1549 and these settings should never be changed once they are set.</p></div>
1550 <div class="paragraph"><p>Additionally, only one of these options can be used per svn-remote
1551 section because they affect the <em>git-svn-id:</em> metadata line, except
1552 for rewriteRoot and rewriteUUID which can be used together.</p></div>
1553 </div>
1554 <h2 id="_basic_examples">BASIC EXAMPLES</h2>
1555 <div class="sectionbody">
1556 <div class="paragraph"><p>Tracking and contributing to the trunk of a Subversion-managed project:</p></div>
1557 <div class="listingblock">
1558 <div class="content">
1559 <pre><tt># Clone a repo (like git clone):
1560 git svn clone http://svn.example.com/project/trunk
1561 # Enter the newly cloned directory:
1562 cd trunk
1563 # You should be on master branch, double-check with 'git branch'
1564 git branch
1565 # Do some work and commit locally to git:
1566 git commit ...
1567 # Something is committed to SVN, rebase your local changes against the
1568 # latest changes in SVN:
1569 git svn rebase
1570 # Now commit your changes (that were committed previously using git) to SVN,
1571 # as well as automatically updating your working HEAD:
1572 git svn dcommit
1573 # Append svn:ignore settings to the default git exclude file:
1574 git svn show-ignore &gt;&gt; .git/info/exclude</tt></pre>
1575 </div></div>
1576 <div class="paragraph"><p>Tracking and contributing to an entire Subversion-managed project
1577 (complete with a trunk, tags and branches):</p></div>
1578 <div class="listingblock">
1579 <div class="content">
1580 <pre><tt># Clone a repo (like git clone):
1581 git svn clone http://svn.example.com/project -T trunk -b branches -t tags
1582 # View all branches and tags you have cloned:
1583 git branch -r
1584 # Create a new branch in SVN
1585 git svn branch waldo
1586 # Reset your master to trunk (or any other branch, replacing 'trunk'
1587 # with the appropriate name):
1588 git reset --hard remotes/trunk
1589 # You may only dcommit to one branch/tag/trunk at a time. The usage
1590 # of dcommit/rebase/show-ignore should be the same as above.</tt></pre>
1591 </div></div>
1592 <div class="paragraph"><p>The initial <em>git svn clone</em> can be quite time-consuming
1593 (especially for large Subversion repositories). If multiple
1594 people (or one person with multiple machines) want to use
1595 <em>git svn</em> to interact with the same Subversion repository, you can
1596 do the initial <em>git svn clone</em> to a repository on a server and
1597 have each person clone that repository with <em>git clone</em>:</p></div>
1598 <div class="listingblock">
1599 <div class="content">
1600 <pre><tt># Do the initial import on a server
1601 ssh server "cd /pub &amp;&amp; git svn clone http://svn.example.com/project
1602 # Clone locally - make sure the refs/remotes/ space matches the server
1603 mkdir project
1604 cd project
1605 git init
1606 git remote add origin server:/pub/project
1607 git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
1608 git fetch
1609 # Prevent fetch/pull from remote git server in the future,
1610 # we only want to use git svn for future updates
1611 git config --remove-section remote.origin
1612 # Create a local branch from one of the branches just fetched
1613 git checkout -b master FETCH_HEAD
1614 # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
1615 git svn init http://svn.example.com/project
1616 # Pull the latest changes from Subversion
1617 git svn rebase</tt></pre>
1618 </div></div>
1619 </div>
1620 <h2 id="_rebase_vs_pull_merge">REBASE VS. PULL/MERGE</h2>
1621 <div class="sectionbody">
1622 <div class="paragraph"><p>Originally, <em>git svn</em> recommended that the <em>remotes/git-svn</em> branch be
1623 pulled or merged from. This is because the author favored
1624 <tt>git svn set-tree B</tt> to commit a single head rather than the
1625 <tt>git svn set-tree A..B</tt> notation to commit multiple commits.</p></div>
1626 <div class="paragraph"><p>If you use <tt>git svn set-tree A..B</tt> to commit several diffs and you do
1627 not have the latest remotes/git-svn merged into my-branch, you should
1628 use <tt>git svn rebase</tt> to update your work branch instead of <tt>git pull</tt> or
1629 <tt>git merge</tt>. <tt>pull</tt>/<tt>merge</tt> can cause non-linear history to be flattened
1630 when committing into SVN, which can lead to merge commits reversing
1631 previous commits in SVN.</p></div>
1632 </div>
1633 <h2 id="_design_philosophy">DESIGN PHILOSOPHY</h2>
1634 <div class="sectionbody">
1635 <div class="paragraph"><p>Merge tracking in Subversion is lacking and doing branched development
1636 with Subversion can be cumbersome as a result. While <em>git svn</em> can track
1637 copy history (including branches and tags) for repositories adopting a
1638 standard layout, it cannot yet represent merge history that happened
1639 inside git back upstream to SVN users. Therefore it is advised that
1640 users keep history as linear as possible inside git to ease
1641 compatibility with SVN (see the CAVEATS section below).</p></div>
1642 </div>
1643 <h2 id="_caveats">CAVEATS</h2>
1644 <div class="sectionbody">
1645 <div class="paragraph"><p>For the sake of simplicity and interoperating with a less-capable system
1646 (SVN), it is recommended that all <em>git svn</em> users clone, fetch and dcommit
1647 directly from the SVN server, and avoid all <em>git clone</em>/<em>pull</em>/<em>merge</em>/<em>push</em>
1648 operations between git repositories and branches. The recommended
1649 method of exchanging code between git branches and users is
1650 <em>git format-patch</em> and <em>git am</em>, or just 'dcommit&#8217;ing to the SVN repository.</p></div>
1651 <div class="paragraph"><p>Running <em>git merge</em> or <em>git pull</em> is NOT recommended on a branch you
1652 plan to <em>dcommit</em> from. Subversion does not represent merges in any
1653 reasonable or useful fashion; so users using Subversion cannot see any
1654 merges you&#8217;ve made. Furthermore, if you merge or pull from a git branch
1655 that is a mirror of an SVN branch, <em>dcommit</em> may commit to the wrong
1656 branch.</p></div>
1657 <div class="paragraph"><p>If you do merge, note the following rule: <em>git svn dcommit</em> will
1658 attempt to commit on top of the SVN commit named in</p></div>
1659 <div class="listingblock">
1660 <div class="content">
1661 <pre><tt>git log --grep=^git-svn-id: --first-parent -1</tt></pre>
1662 </div></div>
1663 <div class="paragraph"><p>You <em>must</em> therefore ensure that the most recent commit of the branch
1664 you want to dcommit to is the <em>first</em> parent of the merge. Chaos will
1665 ensue otherwise, especially if the first parent is an older commit on
1666 the same SVN branch.</p></div>
1667 <div class="paragraph"><p><em>git clone</em> does not clone branches under the refs/remotes/ hierarchy or
1668 any <em>git svn</em> metadata, or config. So repositories created and managed with
1669 using <em>git svn</em> should use <em>rsync</em> for cloning, if cloning is to be done
1670 at all.</p></div>
1671 <div class="paragraph"><p>Since <em>dcommit</em> uses rebase internally, any git branches you <em>git push</em> to
1672 before <em>dcommit</em> on will require forcing an overwrite of the existing ref
1673 on the remote repository. This is generally considered bad practice,
1674 see the <a href="git-push.html">git-push(1)</a> documentation for details.</p></div>
1675 <div class="paragraph"><p>Do not use the --amend option of <a href="git-commit.html">git-commit(1)</a> on a change you&#8217;ve
1676 already dcommitted. It is considered bad practice to --amend commits
1677 you&#8217;ve already pushed to a remote repository for other users, and
1678 dcommit with SVN is analogous to that.</p></div>
1679 <div class="paragraph"><p>When using multiple --branches or --tags, <em>git svn</em> does not automatically
1680 handle name collisions (for example, if two branches from different paths have
1681 the same name, or if a branch and a tag have the same name). In these cases,
1682 use <em>init</em> to set up your git repository then, before your first <em>fetch</em>, edit
1683 the .git/config file so that the branches and tags are associated with
1684 different name spaces. For example:</p></div>
1685 <div class="literalblock">
1686 <div class="content">
1687 <pre><tt>branches = stable/*:refs/remotes/svn/stable/*
1688 branches = debug/*:refs/remotes/svn/debug/*</tt></pre>
1689 </div></div>
1690 </div>
1691 <h2 id="_bugs">BUGS</h2>
1692 <div class="sectionbody">
1693 <div class="paragraph"><p>We ignore all SVN properties except svn:executable. Any unhandled
1694 properties are logged to $GIT_DIR/svn/&lt;refname&gt;/unhandled.log</p></div>
1695 <div class="paragraph"><p>Renamed and copied directories are not detected by git and hence not
1696 tracked when committing to SVN. I do not plan on adding support for
1697 this as it&#8217;s quite difficult and time-consuming to get working for all
1698 the possible corner cases (git doesn&#8217;t do it, either). Committing
1699 renamed and copied files are fully supported if they&#8217;re similar enough
1700 for git to detect them.</p></div>
1701 </div>
1702 <h2 id="_configuration">CONFIGURATION</h2>
1703 <div class="sectionbody">
1704 <div class="paragraph"><p><em>git svn</em> stores [svn-remote] configuration information in the
1705 repository .git/config file. It is similar the core git
1706 [remote] sections except <em>fetch</em> keys do not accept glob
1707 arguments; but they are instead handled by the <em>branches</em>
1708 and <em>tags</em> keys. Since some SVN repositories are oddly
1709 configured with multiple projects glob expansions such those
1710 listed below are allowed:</p></div>
1711 <div class="listingblock">
1712 <div class="content">
1713 <pre><tt>[svn-remote "project-a"]
1714 url = http://server.org/svn
1715 fetch = trunk/project-a:refs/remotes/project-a/trunk
1716 branches = branches/*/project-a:refs/remotes/project-a/branches/*
1717 tags = tags/*/project-a:refs/remotes/project-a/tags/*</tt></pre>
1718 </div></div>
1719 <div class="paragraph"><p>Keep in mind that the <em>*</em> (asterisk) wildcard of the local ref
1720 (right of the <em>:</em>) <strong>must</strong> be the farthest right path component;
1721 however the remote wildcard may be anywhere as long as it&#8217;s an
1722 independent path component (surrounded by <em>/</em> or EOL). This
1723 type of configuration is not automatically created by <em>init</em> and
1724 should be manually entered with a text-editor or using <em>git config</em>.</p></div>
1725 <div class="paragraph"><p>It is also possible to fetch a subset of branches or tags by using a
1726 comma-separated list of names within braces. For example:</p></div>
1727 <div class="listingblock">
1728 <div class="content">
1729 <pre><tt>[svn-remote "huge-project"]
1730 url = http://server.org/svn
1731 fetch = trunk/src:refs/remotes/trunk
1732 branches = branches/{red,green}/src:refs/remotes/branches/*
1733 tags = tags/{1.0,2.0}/src:refs/remotes/tags/*</tt></pre>
1734 </div></div>
1735 <div class="paragraph"><p>Note that git-svn keeps track of the highest revision in which a branch
1736 or tag has appeared. If the subset of branches or tags is changed after
1737 fetching, then .git/svn/.metadata must be manually edited to remove (or
1738 reset) branches-maxRev and/or tags-maxRev as appropriate.</p></div>
1739 </div>
1740 <h2 id="_see_also">SEE ALSO</h2>
1741 <div class="sectionbody">
1742 <div class="paragraph"><p><a href="git-rebase.html">git-rebase(1)</a></p></div>
1743 </div>
1744 <h2 id="_git">GIT</h2>
1745 <div class="sectionbody">
1746 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1747 </div>
1748 <div id="footer">
1749 <div id="footer-text">
1750 Last updated 2011-03-15 23:30:14 UTC
1751 </div>
1752 </div>
1753 </body>
1754 </html>