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">
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">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.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
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
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
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
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
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-svn(
1) Manual Page
409 <div class=
"sectionbody">
411 Bidirectional operation between a Subversion repository and git
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"paragraph"><p><em>git svn
</em> <command
> [options] [arguments]
</p></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>
432 <h2 id=
"_commands">COMMANDS
</h2>
433 <div class=
"sectionbody">
434 <div class=
"dlist"><dl>
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
448 <div class=
"dlist"><dl>
450 -T
<trunk_subdir
>
453 --trunk=
<trunk_subdir
>
456 -t
<tags_subdir
>
459 --tags=
<tags_subdir
>
462 -b
<branches_subdir
>
465 --branches=
<branches_subdir
>
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.
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.
502 Set the
<em>useSvmProps
</em> option in the [svn-remote] config.
510 Set the
<em>useSvnsyncProps
</em> option in the [svn-remote] config.
514 --rewrite-root=
<URL
>
518 Set the
<em>rewriteRoot
</em> option in the [svn-remote] config.
522 --rewrite-uuid=
<UUID
>
526 Set the
<em>rewriteUUID
</em> option in the [svn-remote] config.
530 --username=
<user
>
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
541 --prefix=
<prefix
>
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.
556 --ignore-paths=
<regex
>
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>.
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).
589 Fetch unfetched revisions from the Subversion remote we are
590 tracking. The name of the [svn-remote
"…"] section in the
591 .git/config file may be specified as an optional command-line
594 <div class=
"dlist"><dl>
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.
604 <div class=
"paragraph"><p>This doesn
’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
’s local Git
607 repository, either don
’t use this option or you should both use it in
608 the same local timezone.
</p></div>
615 Fetch only from the SVN parent of the current HEAD.
619 --ignore-paths=
<regex
>
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.
629 <div class=
"verseblock">
630 <div class=
"verseblock-content">config key: svn-remote.
<name
>.ignore-paths
</div>
631 <div class=
"verseblock-attribution">
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>
638 Skip
"doc*" directory for every fetch
641 <div class=
"listingblock">
642 <div class=
"content">
643 <pre><tt>--ignore-paths=
"^doc"</tt></pre>
647 Skip
"branches" and
"tags" of first level directories
650 <div class=
"listingblock">
651 <div class=
"content">
652 <pre><tt>--ignore-paths=
"^[^/]+/(?:branches|tags)"</tt></pre>
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.
672 When committing to svn from git (as part of commit or dcommit
673 operations), if the existing log message doesn
’t already have a
674 From: or Signed-off-by: line, append a From: line based on the
675 git commit
’s author string. If you use this, then --use-log-author
676 will retrieve a valid author string for all commits.
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.
702 This fetches revisions from the SVN parent of the current HEAD
703 and rebases the current (uncommitted to SVN) work against it.
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>
722 Do not fetch remotely; only run
<em>git rebase
</em> against the
723 last fetched commit from the upstream SVN.
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
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
743 This is advantageous over
<em>set-tree
</em> (below) because it produces
744 cleaner, more linear history.
746 <div class=
"dlist"><dl>
752 After committing, do not rebase or reset.
756 --commit-url
<URL
>
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.
766 <div class=
"verseblock">
767 <div class=
"verseblock-content">config key: svn-remote.
<name
>.commiturl
768 config key: svn.commiturl (overwrites all svn-remote.
<name
>.commiturl options)
</div>
769 <div class=
"verseblock-attribution">
771 <div class=
"paragraph"><p>Using this option for any other purpose (don
’t ask) is very strongly
772 discouraged.
</p></div>
775 --mergeinfo=
<mergeinfo
>
779 Add the given merge information during the dcommit
780 (e.g.
<tt>--mergeinfo=
"/branches/foo:1-10"</tt>). All svn server versions can
781 store this information (as a property), and svn clients starting from
782 version
1.5 can make use of it.
<em>git svn
</em> currently does not use it
783 and does not set it automatically.
793 Create a branch in the SVN repository.
795 <div class=
"dlist"><dl>
804 Allows to specify the commit message.
815 Create a tag by using the tags_subdir instead of the branches_subdir
816 specified during git svn init.
827 If more than one --branches (or --tags) option was given to the
<em>init
</em>
828 or
<em>clone
</em> command, you must provide the location of the branch (or
829 tag) you wish to create in the SVN repository. The value of this
830 option must match one of the paths specified by a --branches (or
831 --tags) option. You can see these paths with the commands
833 <div class=
"literalblock">
834 <div class=
"content">
835 <pre><tt>git config --get-all svn-remote.
<name
>.branches
836 git config --get-all svn-remote.
<name
>.tags
</tt></pre>
838 <div class=
"paragraph"><p>where
<name
> is the name of the SVN repository as specified by the -R option to
839 <em>init
</em> (or
"svn" by default).
</p></div>
846 Specify the SVN username to perform the commit as. This option overrides
847 the
<em>username
</em> configuration property.
855 Use the specified URL to connect to the destination Subversion
856 repository. This is useful in cases where the source SVN
857 repository is read-only. This option overrides configuration
858 property
<em>commiturl
</em>.
860 <div class=
"literalblock">
861 <div class=
"content">
862 <pre><tt>git config --get-all svn-remote.
<name
>.commiturl
</tt></pre>
872 Create a tag in the SVN repository. This is a shorthand for
881 This should make it easy to look up svn log messages when svn
882 users refer to -r/--revision numbers.
884 <div class=
"paragraph"><p>The following features from
‘svn log
’ are supported:
</p></div>
885 <div class=
"dlist"><dl>
887 -r
<n
>[:
<n
>]
890 --revision=
<n
>[:
<n
>]
894 is supported, non-numeric args are not:
895 HEAD, NEXT, BASE, PREV, etc
…
906 it
’s not completely compatible with the --verbose
907 output in svn log, but reasonably close.
915 is NOT the same as --max-count, doesn
’t count
916 merged/excluded commits
928 <div class=
"paragraph"><p>New features:
</p></div>
929 <div class=
"dlist"><dl>
935 shows the git commit sha1, as well
943 our version of --pretty=oneline
947 <div class=
"admonitionblock">
950 <div class=
"title">Note
</div>
952 <td class=
"content">SVN itself only stores times in UTC and nothing else. The regular svn
953 client converts the UTC time to the local time (or based on the TZ=
954 environment). This command has the same behaviour.
</td>
957 <div class=
"paragraph"><p>Any other arguments are passed directly to
<em>git log
</em></p></div>
964 Show what revision and author last modified each line of a file. The
965 output of this mode is format-compatible with the output of
966 ‘svn blame
’ by default. Like the SVN blame command,
967 local uncommitted changes in the working copy are ignored;
968 the version of the file in the HEAD revision is annotated. Unknown
969 arguments are passed directly to
<em>git blame
</em>.
971 <div class=
"dlist"><dl>
977 Produce output in the same format as
<em>git blame
</em>, but with
978 SVN revision numbers instead of git commit hashes. In this mode,
979 changes that haven
’t been committed to SVN (including local
980 working-copy edits) are shown as revision
0.
990 When given an SVN revision number of the form
<em>rN
</em>, returns the
991 corresponding git commit hash (this can optionally be followed by a
992 tree-ish to specify which branch should be searched). When given a
993 tree-ish, returns the corresponding SVN revision number.
1001 You should consider using
<em>dcommit
</em> instead of this command.
1002 Commit specified commit or tree objects to SVN. This relies on
1003 your imported fetch data being up-to-date. This makes
1004 absolutely no attempts to do patching when committing to SVN, it
1005 simply overwrites files with those specified in the tree or
1006 commit. All merging is assumed to have taken place
1007 independently of
<em>git svn
</em> functions.
1010 <dt class=
"hdlist1">
1011 <em>create-ignore
</em>
1015 Recursively finds the svn:ignore property on directories and
1016 creates matching .gitignore files. The resulting files are staged to
1017 be committed, but are not committed. Use -r/--revision to refer to a
1021 <dt class=
"hdlist1">
1022 <em>show-ignore
</em>
1026 Recursively finds and lists the svn:ignore property on
1027 directories. The output is suitable for appending to
1028 the $GIT_DIR/info/exclude file.
1031 <dt class=
"hdlist1">
1036 Attempts to recreate empty directories that core git cannot track
1037 based on information in $GIT_DIR/svn/
<refname
>/unhandled.log files.
1038 Empty directories are automatically recreated when using
1039 "git svn clone" and
"git svn rebase", so
"mkdirs" is intended
1040 for use after commands like
"git checkout" or
"git reset".
1041 (See the svn-remote.
<name
>.automkdirs config file option for
1045 <dt class=
"hdlist1">
1046 <em>commit-diff
</em>
1050 Commits the diff of two tree-ish arguments from the
1051 command-line. This command does not rely on being inside an
<tt>git svn
1052 init
</tt>-ed repository. This command takes three arguments, (a) the
1053 original tree to diff against, (b) the new tree result, (c) the
1054 URL of the target Subversion repository. The final argument
1055 (URL) may be omitted if you are working from a
<em>git svn
</em>-aware
1056 repository (that has been
<tt>init
</tt>-ed with
<em>git svn
</em>).
1057 The -r
<revision
> option is required for this.
1060 <dt class=
"hdlist1">
1065 Shows information about a file or directory similar to what
1066 ‘svn info
’ provides. Does not currently support a -r/--revision
1067 argument. Use the --url option to output only the value of the
1068 <em>URL:
</em> field.
1071 <dt class=
"hdlist1">
1076 Lists the properties stored in the Subversion repository about a
1077 given file or directory. Use -r/--revision to refer to a specific
1078 Subversion revision.
1081 <dt class=
"hdlist1">
1086 Gets the Subversion property given as the first argument, for a
1087 file. A specific revision can be specified with -r/--revision.
1090 <dt class=
"hdlist1">
1091 <em>show-externals
</em>
1095 Shows the Subversion externals. Use -r/--revision to specify a
1099 <dt class=
"hdlist1">
1104 Compress $GIT_DIR/svn/
<refname
>/unhandled.log files in .git/svn
1105 and remove $GIT_DIR/svn/
<refname
>index files in .git/svn.
1108 <dt class=
"hdlist1">
1113 Undoes the effects of
<em>fetch
</em> back to the specified revision.
1114 This allows you to re-
<em>fetch
</em> an SVN revision. Normally the
1115 contents of an SVN revision should never change and
<em>reset
</em>
1116 should not be necessary. However, if SVN permissions change,
1117 or if you alter your --ignore-paths option, a
<em>fetch
</em> may fail
1118 with
"not found in commit" (file not previously visible) or
1119 "checksum mismatch" (missed a modification). If the problem
1120 file cannot be ignored forever (with --ignore-paths) the only
1121 way to repair the repo is to use
<em>reset
</em>.
1123 <div class=
"paragraph"><p>Only the rev_map and refs/remotes/git-svn are changed. Follow
<em>reset
</em>
1124 with a
<em>fetch
</em> and then
<em>git reset
</em> or
<em>git rebase
</em> to move local
1125 branches onto the new tree.
</p></div>
1126 <div class=
"dlist"><dl>
1127 <dt class=
"hdlist1">
1130 <dt class=
"hdlist1">
1131 --revision=
<n
>
1135 Specify the most recent revision to keep. All later revisions
1139 <dt class=
"hdlist1">
1142 <dt class=
"hdlist1">
1147 Discard the specified revision as well, keeping the nearest
1151 <dt class=
"hdlist1">
1156 Assume you have local changes in
"master", but you need to refetch
"r2".
1158 <div class=
"listingblock">
1159 <div class=
"content">
1160 <pre><tt> r1---r2---r3 remotes/git-svn
1162 A---B master
</tt></pre>
1164 <div class=
"paragraph"><p>Fix the ignore-paths or SVN permissions problem that caused
"r2" to
1165 be incomplete in the first place. Then:
</p></div>
1166 <div class=
"verseblock">
1167 <div class=
"verseblock-content">git svn reset -r2 -p
1169 <div class=
"verseblock-attribution">
1171 <div class=
"listingblock">
1172 <div class=
"content">
1173 <pre><tt> r1---r2'--r3' remotes/git-svn
1175 r2---r3---A---B master
</tt></pre>
1177 <div class=
"paragraph"><p>Then fixup
"master" with
<em>git rebase
</em>.
1178 Do NOT use
<em>git merge
</em> or your history will not be compatible with a
1179 future
<em>dcommit
</em>!
</p></div>
1180 <div class=
"verseblock">
1181 <div class=
"verseblock-content">git rebase --onto remotes/git-svn A^ master
</div>
1182 <div class=
"verseblock-attribution">
1184 <div class=
"listingblock">
1185 <div class=
"content">
1186 <pre><tt> r1---r2'--r3' remotes/git-svn
1188 A'--B' master
</tt></pre>
1195 <h2 id=
"_options">OPTIONS
</h2>
1196 <div class=
"sectionbody">
1197 <div class=
"dlist"><dl>
1198 <dt class=
"hdlist1">
1199 --shared[=(false|true|umask|group|all|world|everybody)]
1201 <dt class=
"hdlist1">
1202 --template=
<template_directory
>
1206 Only used with the
<em>init
</em> command.
1207 These are passed directly to
<em>git init
</em>.
1210 <dt class=
"hdlist1">
1213 <dt class=
"hdlist1">
1214 --revision
<arg
>
1218 Used with the
<em>fetch
</em> command.
1220 <div class=
"paragraph"><p>This allows revision ranges for partial/cauterized history
1221 to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
1222 $NUMBER:HEAD, and BASE:$NUMBER are all supported.
</p></div>
1223 <div class=
"paragraph"><p>This can allow you to make partial mirrors when running fetch;
1224 but is generally not recommended because history will be skipped
1227 <dt class=
"hdlist1">
1230 <dt class=
"hdlist1">
1235 Only used with the
<em>set-tree
</em> command.
1237 <div class=
"paragraph"><p>Read a list of commits from stdin and commit them in reverse
1238 order. Only the leading sha1 is read from each line, so
1239 <em>git rev-list --pretty=oneline
</em> output can be used.
</p></div>
1241 <dt class=
"hdlist1">
1246 Only used with the
<em>dcommit
</em>,
<em>set-tree
</em> and
<em>commit-diff
</em> commands.
1248 <div class=
"paragraph"><p>Remove directories from the SVN tree if there are no files left
1249 behind. SVN can version empty directories, and they are not
1250 removed by default if there are no files left in them. git
1251 cannot version empty directories. Enabling this flag will make
1252 the commit to SVN act like git.
</p></div>
1253 <div class=
"verseblock">
1254 <div class=
"verseblock-content">config key: svn.rmdir
</div>
1255 <div class=
"verseblock-attribution">
1258 <dt class=
"hdlist1">
1261 <dt class=
"hdlist1">
1266 Only used with the
<em>dcommit
</em>,
<em>set-tree
</em> and
<em>commit-diff
</em> commands.
1268 <div class=
"paragraph"><p>Edit the commit message before committing to SVN. This is off by
1269 default for objects that are commits, and forced on when committing
1270 tree objects.
</p></div>
1271 <div class=
"verseblock">
1272 <div class=
"verseblock-content">config key: svn.edit
</div>
1273 <div class=
"verseblock-attribution">
1276 <dt class=
"hdlist1">
1279 <dt class=
"hdlist1">
1280 --find-copies-harder
1284 Only used with the
<em>dcommit
</em>,
<em>set-tree
</em> and
<em>commit-diff
</em> commands.
1286 <div class=
"paragraph"><p>They are both passed directly to
<em>git diff-tree
</em>; see
1287 <a href=
"git-diff-tree.html">git-diff-tree(
1)
</a> for more information.
</p></div>
1288 <div class=
"verseblock">
1289 <div class=
"verseblock-content">config key: svn.l
1290 config key: svn.findcopiesharder
</div>
1291 <div class=
"verseblock-attribution">
1294 <dt class=
"hdlist1">
1297 <dt class=
"hdlist1">
1298 --authors-file=
<filename
>
1302 Syntax is compatible with the file used by
<em>git cvsimport
</em>:
1304 <div class=
"listingblock">
1305 <div class=
"content">
1306 <pre><tt> loginname = Joe User
<user@example.com
></tt></pre>
1308 <div class=
"paragraph"><p>If this option is specified and
<em>git svn
</em> encounters an SVN
1309 committer name that does not exist in the authors-file,
<em>git svn
</em>
1310 will abort operation. The user will then have to add the
1311 appropriate entry. Re-running the previous
<em>git svn
</em> command
1312 after the authors-file is modified should continue operation.
</p></div>
1313 <div class=
"verseblock">
1314 <div class=
"verseblock-content">config key: svn.authorsfile
</div>
1315 <div class=
"verseblock-attribution">
1318 <dt class=
"hdlist1">
1319 --authors-prog=
<filename
>
1323 If this option is specified, for each SVN committer name that
1324 does not exist in the authors file, the given file is executed
1325 with the committer name as the first argument. The program is
1326 expected to return a single line of the form
"Name <email>",
1327 which will be treated as if included in the authors file.
1330 <dt class=
"hdlist1">
1333 <dt class=
"hdlist1">
1338 Make
<em>git svn
</em> less verbose. Specify a second time to make it
1342 <dt class=
"hdlist1">
1343 --repack[=
<n
>]
1345 <dt class=
"hdlist1">
1346 --repack-flags=
<flags
>
1350 These should help keep disk usage sane for large fetches with
1353 <div class=
"paragraph"><p>--repack takes an optional argument for the number of revisions
1354 to fetch before repacking. This defaults to repacking every
1355 1000 commits fetched if no argument is specified.
</p></div>
1356 <div class=
"paragraph"><p>--repack-flags are passed directly to
<em>git repack
</em>.
</p></div>
1357 <div class=
"verseblock">
1358 <div class=
"verseblock-content">config key: svn.repack
1359 config key: svn.repackflags
</div>
1360 <div class=
"verseblock-attribution">
1363 <dt class=
"hdlist1">
1366 <dt class=
"hdlist1">
1369 <dt class=
"hdlist1">
1372 <dt class=
"hdlist1">
1373 --strategy=
<strategy
>
1377 These are only used with the
<em>dcommit
</em> and
<em>rebase
</em> commands.
1379 <div class=
"paragraph"><p>Passed directly to
<em>git rebase
</em> when using
<em>dcommit
</em> if a
1380 <em>git reset
</em> cannot be used (see
<em>dcommit
</em>).
</p></div>
1382 <dt class=
"hdlist1">
1385 <dt class=
"hdlist1">
1390 This can be used with the
<em>dcommit
</em>,
<em>rebase
</em>,
<em>branch
</em> and
1391 <em>tag
</em> commands.
1393 <div class=
"paragraph"><p>For
<em>dcommit
</em>, print out the series of git arguments that would show
1394 which diffs would be committed to SVN.
</p></div>
1395 <div class=
"paragraph"><p>For
<em>rebase
</em>, display the local branch associated with the upstream svn
1396 repository associated with the current branch and the URL of svn
1397 repository that will be fetched from.
</p></div>
1398 <div class=
"paragraph"><p>For
<em>branch
</em> and
<em>tag
</em>, display the urls that will be used for copying when
1399 creating the branch or tag.
</p></div>
1403 <h2 id=
"_advanced_options">ADVANCED OPTIONS
</h2>
1404 <div class=
"sectionbody">
1405 <div class=
"dlist"><dl>
1406 <dt class=
"hdlist1">
1407 -i
<GIT_SVN_ID
>
1409 <dt class=
"hdlist1">
1410 --id
<GIT_SVN_ID
>
1414 This sets GIT_SVN_ID (instead of using the environment). This
1415 allows the user to override the default refname to fetch from
1416 when tracking a single URL. The
<em>log
</em> and
<em>dcommit
</em> commands
1417 no longer require this switch as an argument.
1420 <dt class=
"hdlist1">
1421 -R
<remote name
>
1423 <dt class=
"hdlist1">
1424 --svn-remote
<remote name
>
1428 Specify the [svn-remote
"<remote name>"] section to use,
1429 this allows SVN multiple repositories to be tracked.
1433 <dt class=
"hdlist1">
1438 This is especially helpful when we
’re tracking a directory
1439 that has been moved around within the repository, or if we
1440 started tracking a branch and never tracked the trunk it was
1441 descended from. This feature is enabled by default, use
1442 --no-follow-parent to disable it.
1444 <div class=
"verseblock">
1445 <div class=
"verseblock-content">config key: svn.followparent
</div>
1446 <div class=
"verseblock-attribution">
1451 <h2 id=
"_config_file_only_options">CONFIG FILE-ONLY OPTIONS
</h2>
1452 <div class=
"sectionbody">
1453 <div class=
"dlist"><dl>
1454 <dt class=
"hdlist1">
1457 <dt class=
"hdlist1">
1458 svn-remote.
<name
>.noMetadata
1462 This gets rid of the
<em>git-svn-id:
</em> lines at the end of every commit.
1464 <div class=
"paragraph"><p>This option can only be used for one-shot imports as
<em>git svn
</em>
1465 will not be able to fetch again without metadata. Additionally,
1466 if you lose your .git/svn/
<strong>*/.rev_map.
</strong> files,
<em>git svn
</em> will not
1467 be able to rebuild them.
</p></div>
1468 <div class=
"paragraph"><p>The
<em>git svn log
</em> command will not work on repositories using
1469 this, either. Using this conflicts with the
<em>useSvmProps
</em>
1470 option for (hopefully) obvious reasons.
</p></div>
1471 <div class=
"paragraph"><p>This option is NOT recommended as it makes it difficult to track down
1472 old references to SVN revision numbers in existing documentation, bug
1473 reports and archives. If you plan to eventually migrate from SVN to git
1474 and are certain about dropping SVN history, consider
1475 <a href=
"git-filter-branch.html">git-filter-branch(
1)
</a> instead. filter-branch also allows
1476 reformatting of metadata for ease-of-reading and rewriting authorship
1477 info for non-
"svn.authorsFile" users.
</p></div>
1479 <dt class=
"hdlist1">
1482 <dt class=
"hdlist1">
1483 svn-remote.
<name
>.useSvmProps
1487 This allows
<em>git svn
</em> to re-map repository URLs and UUIDs from
1488 mirrors created using SVN::Mirror (or svk) for metadata.
1490 <div class=
"paragraph"><p>If an SVN revision has a property,
"svm:headrev", it is likely
1491 that the revision was created by SVN::Mirror (also used by SVK).
1492 The property contains a repository UUID and a revision. We want
1493 to make it look like we are mirroring the original URL, so
1494 introduce a helper function that returns the original identity
1495 URL and UUID, and use it when generating metadata in commit
1498 <dt class=
"hdlist1">
1501 <dt class=
"hdlist1">
1502 svn-remote.
<name
>.useSvnsyncprops
1506 Similar to the useSvmProps option; this is for users
1507 of the svnsync(
1) command distributed with SVN
1.4.x and
1511 <dt class=
"hdlist1">
1512 svn-remote.
<name
>.rewriteRoot
1516 This allows users to create repositories from alternate
1517 URLs. For example, an administrator could run
<em>git svn
</em> on the
1518 server locally (accessing via file://) but wish to distribute
1519 the repository with a public http:// or svn:// URL in the
1520 metadata so users of it will see the public URL.
1523 <dt class=
"hdlist1">
1524 svn-remote.
<name
>.rewriteUUID
1528 Similar to the useSvmProps option; this is for users who need
1529 to remap the UUID manually. This may be useful in situations
1530 where the original UUID is not available via either useSvmProps
1534 <dt class=
"hdlist1">
1535 svn-remote.
<name
>.pushurl
1539 Similar to git
’s
<em>remote.
<name
>.pushurl
</em>, this key is designed
1540 to be used in cases where
<em>url
</em> points to an SVN repository
1541 via a read-only transport, to provide an alternate read/write
1542 transport. It is assumed that both keys point to the same
1543 repository. Unlike
<em>commiturl
</em>,
<em>pushurl
</em> is a base path. If
1544 either
<em>commiturl
</em> or
<em>pushurl
</em> could be used,
<em>commiturl
</em>
1548 <dt class=
"hdlist1">
1549 svn.brokenSymlinkWorkaround
1553 This disables potentially expensive checks to workaround
1554 broken symlinks checked into SVN by broken clients. Set this
1555 option to
"false" if you track a SVN repository with many
1556 empty blobs that are not symlinks. This option may be changed
1557 while
<em>git svn
</em> is running and take effect on the next
1558 revision fetched. If unset,
<em>git svn
</em> assumes this option to
1562 <dt class=
"hdlist1">
1563 svn.pathnameencoding
1567 This instructs git svn to recode pathnames to a given encoding.
1568 It can be used by windows users and by those who work in non-utf8
1569 locales to avoid corrupted file names with non-ASCII characters.
1570 Valid encodings are the ones supported by Perl
’s Encode module.
1573 <dt class=
"hdlist1">
1574 svn-remote.
<name
>.automkdirs
1578 Normally, the
"git svn clone" and
"git svn rebase" commands
1579 attempt to recreate empty directories that are in the
1580 Subversion repository. If this option is set to
"false", then
1581 empty directories will only be created if the
"git svn mkdirs"
1582 command is run explicitly. If unset,
<em>git svn
</em> assumes this
1583 option to be
"true".
1587 <div class=
"paragraph"><p>Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
1588 options all affect the metadata generated and used by
<em>git svn
</em>; they
1589 <strong>must
</strong> be set in the configuration file before any history is imported
1590 and these settings should never be changed once they are set.
</p></div>
1591 <div class=
"paragraph"><p>Additionally, only one of these options can be used per svn-remote
1592 section because they affect the
<em>git-svn-id:
</em> metadata line, except
1593 for rewriteRoot and rewriteUUID which can be used together.
</p></div>
1595 <h2 id=
"_basic_examples">BASIC EXAMPLES
</h2>
1596 <div class=
"sectionbody">
1597 <div class=
"paragraph"><p>Tracking and contributing to the trunk of a Subversion-managed project:
</p></div>
1598 <div class=
"listingblock">
1599 <div class=
"content">
1600 <pre><tt># Clone a repo (like git clone):
1601 git svn clone http://svn.example.com/project/trunk
1602 # Enter the newly cloned directory:
1604 # You should be on master branch, double-check with 'git branch'
1606 # Do some work and commit locally to git:
1608 # Something is committed to SVN, rebase your local changes against the
1609 # latest changes in SVN:
1611 # Now commit your changes (that were committed previously using git) to SVN,
1612 # as well as automatically updating your working HEAD:
1614 # Append svn:ignore settings to the default git exclude file:
1615 git svn show-ignore
>> .git/info/exclude
</tt></pre>
1617 <div class=
"paragraph"><p>Tracking and contributing to an entire Subversion-managed project
1618 (complete with a trunk, tags and branches):
</p></div>
1619 <div class=
"listingblock">
1620 <div class=
"content">
1621 <pre><tt># Clone a repo (like git clone):
1622 git svn clone http://svn.example.com/project -T trunk -b branches -t tags
1623 # View all branches and tags you have cloned:
1625 # Create a new branch in SVN
1626 git svn branch waldo
1627 # Reset your master to trunk (or any other branch, replacing 'trunk'
1628 # with the appropriate name):
1629 git reset --hard remotes/trunk
1630 # You may only dcommit to one branch/tag/trunk at a time. The usage
1631 # of dcommit/rebase/show-ignore should be the same as above.
</tt></pre>
1633 <div class=
"paragraph"><p>The initial
<em>git svn clone
</em> can be quite time-consuming
1634 (especially for large Subversion repositories). If multiple
1635 people (or one person with multiple machines) want to use
1636 <em>git svn
</em> to interact with the same Subversion repository, you can
1637 do the initial
<em>git svn clone
</em> to a repository on a server and
1638 have each person clone that repository with
<em>git clone
</em>:
</p></div>
1639 <div class=
"listingblock">
1640 <div class=
"content">
1641 <pre><tt># Do the initial import on a server
1642 ssh server
"cd /pub && git svn clone http://svn.example.com/project
1643 # Clone locally - make sure the refs/remotes/ space matches the server
1647 git remote add origin server:/pub/project
1648 git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
1650 # Prevent fetch/pull from remote git server in the future,
1651 # we only want to use git svn for future updates
1652 git config --remove-section remote.origin
1653 # Create a local branch from one of the branches just fetched
1654 git checkout -b master FETCH_HEAD
1655 # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
1656 git svn init http://svn.example.com/project
1657 # Pull the latest changes from Subversion
1658 git svn rebase</tt></pre>
1661 <h2 id="_rebase_vs_pull_merge
">REBASE VS. PULL/MERGE</h2>
1662 <div class="sectionbody
">
1663 <div class="paragraph
"><p>Originally, <em>git svn</em> recommended that the <em>remotes/git-svn</em> branch be
1664 pulled or merged from. This is because the author favored
1665 <tt>git svn set-tree B</tt> to commit a single head rather than the
1666 <tt>git svn set-tree A..B</tt> notation to commit multiple commits.</p></div>
1667 <div class="paragraph
"><p>If you use <tt>git svn set-tree A..B</tt> to commit several diffs and you do
1668 not have the latest remotes/git-svn merged into my-branch, you should
1669 use <tt>git svn rebase</tt> to update your work branch instead of <tt>git pull</tt> or
1670 <tt>git merge</tt>. <tt>pull</tt>/<tt>merge</tt> can cause non-linear history to be flattened
1671 when committing into SVN, which can lead to merge commits reversing
1672 previous commits in SVN.</p></div>
1674 <h2 id="_design_philosophy
">DESIGN PHILOSOPHY</h2>
1675 <div class="sectionbody
">
1676 <div class="paragraph
"><p>Merge tracking in Subversion is lacking and doing branched development
1677 with Subversion can be cumbersome as a result. While <em>git svn</em> can track
1678 copy history (including branches and tags) for repositories adopting a
1679 standard layout, it cannot yet represent merge history that happened
1680 inside git back upstream to SVN users. Therefore it is advised that
1681 users keep history as linear as possible inside git to ease
1682 compatibility with SVN (see the CAVEATS section below).</p></div>
1684 <h2 id="_caveats
">CAVEATS</h2>
1685 <div class="sectionbody
">
1686 <div class="paragraph
"><p>For the sake of simplicity and interoperating with a less-capable system
1687 (SVN), it is recommended that all <em>git svn</em> users clone, fetch and dcommit
1688 directly from the SVN server, and avoid all <em>git clone</em>/<em>pull</em>/<em>merge</em>/<em>push</em>
1689 operations between git repositories and branches. The recommended
1690 method of exchanging code between git branches and users is
1691 <em>git format-patch</em> and <em>git am</em>, or just 'dcommit’ing to the SVN repository.</p></div>
1692 <div class="paragraph
"><p>Running <em>git merge</em> or <em>git pull</em> is NOT recommended on a branch you
1693 plan to <em>dcommit</em> from. Subversion does not represent merges in any
1694 reasonable or useful fashion; so users using Subversion cannot see any
1695 merges you’ve made. Furthermore, if you merge or pull from a git branch
1696 that is a mirror of an SVN branch, <em>dcommit</em> may commit to the wrong
1698 <div class="paragraph
"><p>If you do merge, note the following rule: <em>git svn dcommit</em> will
1699 attempt to commit on top of the SVN commit named in</p></div>
1700 <div class="listingblock
">
1701 <div class="content
">
1702 <pre><tt>git log --grep=^git-svn-id: --first-parent -1</tt></pre>
1704 <div class="paragraph
"><p>You <em>must</em> therefore ensure that the most recent commit of the branch
1705 you want to dcommit to is the <em>first</em> parent of the merge. Chaos will
1706 ensue otherwise, especially if the first parent is an older commit on
1707 the same SVN branch.</p></div>
1708 <div class="paragraph
"><p><em>git clone</em> does not clone branches under the refs/remotes/ hierarchy or
1709 any <em>git svn</em> metadata, or config. So repositories created and managed with
1710 using <em>git svn</em> should use <em>rsync</em> for cloning, if cloning is to be done
1712 <div class="paragraph
"><p>Since <em>dcommit</em> uses rebase internally, any git branches you <em>git push</em> to
1713 before <em>dcommit</em> on will require forcing an overwrite of the existing ref
1714 on the remote repository. This is generally considered bad practice,
1715 see the <a href="git-push.html
">git-push(1)</a> documentation for details.</p></div>
1716 <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
1717 already dcommitted. It is considered bad practice to --amend commits
1718 you’ve already pushed to a remote repository for other users, and
1719 dcommit with SVN is analogous to that.</p></div>
1720 <div class="paragraph
"><p>When using multiple --branches or --tags, <em>git svn</em> does not automatically
1721 handle name collisions (for example, if two branches from different paths have
1722 the same name, or if a branch and a tag have the same name). In these cases,
1723 use <em>init</em> to set up your git repository then, before your first <em>fetch</em>, edit
1724 the .git/config file so that the branches and tags are associated with
1725 different name spaces. For example:</p></div>
1726 <div class="literalblock
">
1727 <div class="content
">
1728 <pre><tt>branches = stable/*:refs/remotes/svn/stable/*
1729 branches = debug/*:refs/remotes/svn/debug/*</tt></pre>
1732 <h2 id="_bugs
">BUGS</h2>
1733 <div class="sectionbody
">
1734 <div class="paragraph
"><p>We ignore all SVN properties except svn:executable. Any unhandled
1735 properties are logged to $GIT_DIR/svn/<refname>/unhandled.log</p></div>
1736 <div class="paragraph
"><p>Renamed and copied directories are not detected by git and hence not
1737 tracked when committing to SVN. I do not plan on adding support for
1738 this as it’s quite difficult and time-consuming to get working for all
1739 the possible corner cases (git doesn’t do it, either). Committing
1740 renamed and copied files are fully supported if they’re similar enough
1741 for git to detect them.</p></div>
1743 <h2 id="_configuration
">CONFIGURATION</h2>
1744 <div class="sectionbody
">
1745 <div class="paragraph
"><p><em>git svn</em> stores [svn-remote] configuration information in the
1746 repository .git/config file. It is similar the core git
1747 [remote] sections except <em>fetch</em> keys do not accept glob
1748 arguments; but they are instead handled by the <em>branches</em>
1749 and <em>tags</em> keys. Since some SVN repositories are oddly
1750 configured with multiple projects glob expansions such those
1751 listed below are allowed:</p></div>
1752 <div class="listingblock
">
1753 <div class="content
">
1754 <pre><tt>[svn-remote "project-a
"]
1755 url = http://server.org/svn
1756 fetch = trunk/project-a:refs/remotes/project-a/trunk
1757 branches = branches/*/project-a:refs/remotes/project-a/branches/*
1758 tags = tags/*/project-a:refs/remotes/project-a/tags/*</tt></pre>
1760 <div class="paragraph
"><p>Keep in mind that the <em>*</em> (asterisk) wildcard of the local ref
1761 (right of the <em>:</em>) <strong>must</strong> be the farthest right path component;
1762 however the remote wildcard may be anywhere as long as it’s an
1763 independent path component (surrounded by <em>/</em> or EOL). This
1764 type of configuration is not automatically created by <em>init</em> and
1765 should be manually entered with a text-editor or using <em>git config</em>.</p></div>
1766 <div class="paragraph
"><p>It is also possible to fetch a subset of branches or tags by using a
1767 comma-separated list of names within braces. For example:</p></div>
1768 <div class="listingblock
">
1769 <div class="content
">
1770 <pre><tt>[svn-remote "huge-project
"]
1771 url = http://server.org/svn
1772 fetch = trunk/src:refs/remotes/trunk
1773 branches = branches/{red,green}/src:refs/remotes/branches/*
1774 tags = tags/{1.0,2.0}/src:refs/remotes/tags/*</tt></pre>
1776 <div class="paragraph
"><p>Note that git-svn keeps track of the highest revision in which a branch
1777 or tag has appeared. If the subset of branches or tags is changed after
1778 fetching, then .git/svn/.metadata must be manually edited to remove (or
1779 reset) branches-maxRev and/or tags-maxRev as appropriate.</p></div>
1781 <h2 id="_see_also
">SEE ALSO</h2>
1782 <div class="sectionbody
">
1783 <div class="paragraph
"><p><a href="git-rebase.html
">git-rebase(1)</a></p></div>
1785 <h2 id="_git
">GIT</h2>
1786 <div class="sectionbody
">
1787 <div class="paragraph
"><p>Part of the <a href="git.html
">git(1)</a> suite</p></div>
1790 <div id="footer-text
">
1791 Last updated 2011-04-27 21:09:28 UTC