1GIT-SVN(1)                        Git Manual                        GIT-SVN(1)
2
3
4

NAME

6       git-svn - Bidirectional operation between a Subversion repository and
7       Git
8

SYNOPSIS

10       git svn <command> [<options>] [<arguments>]
11

DESCRIPTION

13       git svn is a simple conduit for changesets between Subversion and Git.
14       It provides a bidirectional flow of changes between a Subversion and a
15       Git repository.
16
17       git svn can track a standard Subversion repository, following the
18       common "trunk/branches/tags" layout, with the --stdlayout option. It
19       can also follow branches and tags in any layout with the -T/-t/-b
20       options (see options to init below, and also the clone command).
21
22       Once tracking a Subversion repository (with any of the above methods),
23       the Git repository can be updated from Subversion by the fetch command
24       and Subversion updated from Git by the dcommit command.
25

COMMANDS

27       init
28           Initializes an empty Git repository with additional metadata
29           directories for git svn. The Subversion URL may be specified as a
30           command-line argument, or as full URL arguments to -T/-t/-b.
31           Optionally, the target directory to operate on can be specified as
32           a second argument. Normally this command initializes the current
33           directory.
34
35           -T<trunk_subdir>, --trunk=<trunk_subdir>, -t<tags_subdir>,
36           --tags=<tags_subdir>, -b<branches_subdir>,
37           --branches=<branches_subdir>, -s, --stdlayout
38               These are optional command-line options for init. Each of these
39               flags can point to a relative repository path
40               (--tags=project/tags) or a full url
41               (--tags=https://foo.org/project/tags). You can specify more
42               than one --tags and/or --branches options, in case your
43               Subversion repository places tags or branches under multiple
44               paths. The option --stdlayout is a shorthand way of setting
45               trunk,tags,branches as the relative paths, which is the
46               Subversion default. If any of the other options are given as
47               well, they take precedence.
48
49           --no-metadata
50               Set the noMetadata option in the [svn-remote] config. This
51               option is not recommended, please read the svn.noMetadata
52               section of this manpage before using this option.
53
54           --use-svm-props
55               Set the useSvmProps option in the [svn-remote] config.
56
57           --use-svnsync-props
58               Set the useSvnsyncProps option in the [svn-remote] config.
59
60           --rewrite-root=<URL>
61               Set the rewriteRoot option in the [svn-remote] config.
62
63           --rewrite-uuid=<UUID>
64               Set the rewriteUUID option in the [svn-remote] config.
65
66           --username=<user>
67               For transports that SVN handles authentication for (http,
68               https, and plain svn), specify the username. For other
69               transports (e.g.  svn+ssh://), you must include the username in
70               the URL, e.g.  svn+ssh://foo@svn.bar.com/project
71
72           --prefix=<prefix>
73               This allows one to specify a prefix which is prepended to the
74               names of remotes if trunk/branches/tags are specified. The
75               prefix does not automatically include a trailing slash, so be
76               sure you include one in the argument if that is what you want.
77               If --branches/-b is specified, the prefix must include a
78               trailing slash. Setting a prefix (with a trailing slash) is
79               strongly encouraged in any case, as your SVN-tracking refs will
80               then be located at "refs/remotes/$prefix/", which is compatible
81               with Git’s own remote-tracking ref layout
82               (refs/remotes/$remote/). Setting a prefix is also useful if you
83               wish to track multiple projects that share a common repository.
84               By default, the prefix is set to origin/.
85
86                   Note
87                   Before Git v2.0, the default prefix was "" (no prefix).
88                   This meant that SVN-tracking refs were put at
89                   "refs/remotes/*", which is incompatible with how Git’s own
90                   remote-tracking refs are organized. If you still want the
91                   old default, you can get it by passing --prefix "" on the
92                   command line (--prefix="" may not work if your Perl’s
93                   Getopt::Long is < v2.37).
94
95           --ignore-refs=<regex>
96               When passed to init or clone this regular expression will be
97               preserved as a config key. See fetch for a description of
98               --ignore-refs.
99
100           --ignore-paths=<regex>
101               When passed to init or clone this regular expression will be
102               preserved as a config key. See fetch for a description of
103               --ignore-paths.
104
105           --include-paths=<regex>
106               When passed to init or clone this regular expression will be
107               preserved as a config key. See fetch for a description of
108               --include-paths.
109
110           --no-minimize-url
111               When tracking multiple directories (using --stdlayout,
112               --branches, or --tags options), git svn will attempt to connect
113               to the root (or highest allowed level) of the Subversion
114               repository. This default allows better tracking of history if
115               entire projects are moved within a repository, but may cause
116               issues on repositories where read access restrictions are in
117               place. Passing --no-minimize-url will allow git svn to accept
118               URLs as-is without attempting to connect to a higher level
119               directory. This option is off by default when only one
120               URL/branch is tracked (it would do little good).
121
122       fetch
123           Fetch unfetched revisions from the Subversion remote we are
124           tracking. The name of the [svn-remote "..."] section in the
125           $GIT_DIR/config file may be specified as an optional command-line
126           argument.
127
128           This automatically updates the rev_map if needed (see
129           $GIT_DIR/svn/**/.rev_map.*  in the FILES section below for
130           details).
131
132           --localtime
133               Store Git commit times in the local time zone instead of UTC.
134               This makes git log (even without --date=local) show the same
135               times that svn log would in the local time zone.
136
137               This doesn’t interfere with interoperating with the Subversion
138               repository you cloned from, but if you wish for your local Git
139               repository to be able to interoperate with someone else’s local
140               Git repository, either don’t use this option or you should both
141               use it in the same local time zone.
142
143           --parent
144               Fetch only from the SVN parent of the current HEAD.
145
146           --ignore-refs=<regex>
147               Ignore refs for branches or tags matching the Perl regular
148               expression. A "negative look-ahead assertion" like
149               ^refs/remotes/origin/(?!tags/wanted-tag|wanted-branch).*$ can
150               be used to allow only certain refs.
151
152                   config key: svn-remote.<name>.ignore-refs
153               If the ignore-refs configuration key is set, and the
154               command-line option is also given, both regular expressions
155               will be used.
156
157           --ignore-paths=<regex>
158               This allows one to specify a Perl regular expression that will
159               cause skipping of all matching paths from checkout from SVN.
160               The --ignore-paths option should match for every fetch
161               (including automatic fetches due to clone, dcommit, rebase,
162               etc) on a given repository.
163
164                   config key: svn-remote.<name>.ignore-paths
165               If the ignore-paths configuration key is set, and the
166               command-line option is also given, both regular expressions
167               will be used.
168
169               Examples:
170
171               Skip "doc*" directory for every fetch
172
173                       --ignore-paths="^doc"
174
175               Skip "branches" and "tags" of first level directories
176
177                       --ignore-paths="^[^/]+/(?:branches|tags)"
178
179           --include-paths=<regex>
180               This allows one to specify a Perl regular expression that will
181               cause the inclusion of only matching paths from checkout from
182               SVN. The --include-paths option should match for every fetch
183               (including automatic fetches due to clone, dcommit, rebase,
184               etc) on a given repository.  --ignore-paths takes precedence
185               over --include-paths.
186
187                   config key: svn-remote.<name>.include-paths
188
189           --log-window-size=<n>
190               Fetch <n> log entries per request when scanning Subversion
191               history. The default is 100. For very large Subversion
192               repositories, larger values may be needed for clone/fetch to
193               complete in reasonable time. But overly large values may lead
194               to higher memory usage and request timeouts.
195
196       clone
197           Runs init and fetch. It will automatically create a directory based
198           on the basename of the URL passed to it; or if a second argument is
199           passed; it will create a directory and work within that. It accepts
200           all arguments that the init and fetch commands accept; with the
201           exception of --fetch-all and --parent. After a repository is
202           cloned, the fetch command will be able to update revisions without
203           affecting the working tree; and the rebase command will be able to
204           update the working tree with the latest changes.
205
206           --preserve-empty-dirs
207               Create a placeholder file in the local Git repository for each
208               empty directory fetched from Subversion. This includes
209               directories that become empty by removing all entries in the
210               Subversion repository (but not the directory itself). The
211               placeholder files are also tracked and removed when no longer
212               necessary.
213
214           --placeholder-filename=<filename>
215               Set the name of placeholder files created by
216               --preserve-empty-dirs. Default: ".gitignore"
217
218       rebase
219           This fetches revisions from the SVN parent of the current HEAD and
220           rebases the current (uncommitted to SVN) work against it.
221
222           This works similarly to svn update or git pull except that it
223           preserves linear history with git rebase instead of git merge for
224           ease of dcommitting with git svn.
225
226           This accepts all options that git svn fetch and git rebase accept.
227           However, --fetch-all only fetches from the current [svn-remote],
228           and not all [svn-remote] definitions.
229
230           Like git rebase; this requires that the working tree be clean and
231           have no uncommitted changes.
232
233           This automatically updates the rev_map if needed (see
234           $GIT_DIR/svn/**/.rev_map.*  in the FILES section below for
235           details).
236
237           -l, --local
238               Do not fetch remotely; only run git rebase against the last
239               fetched commit from the upstream SVN.
240
241       dcommit
242           Commit each diff from the current branch directly to the SVN
243           repository, and then rebase or reset (depending on whether or not
244           there is a diff between SVN and head). This will create a revision
245           in SVN for each commit in Git.
246
247           When an optional Git branch name (or a Git commit object name) is
248           specified as an argument, the subcommand works on the specified
249           branch, not on the current branch.
250
251           Use of dcommit is preferred to set-tree (below).
252
253           --no-rebase
254               After committing, do not rebase or reset.
255
256           --commit-url <URL>
257               Commit to this SVN URL (the full path). This is intended to
258               allow existing git svn repositories created with one transport
259               method (e.g.  svn:// or http:// for anonymous read) to be
260               reused if a user is later given access to an alternate
261               transport method (e.g.  svn+ssh:// or https://) for commit.
262
263                   config key: svn-remote.<name>.commiturl
264                   config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
265               Note that the SVN URL of the commiturl config key includes the
266               SVN branch. If you rather want to set the commit URL for an
267               entire SVN repository use svn-remote.<name>.pushurl instead.
268
269               Using this option for any other purpose (don’t ask) is very
270               strongly discouraged.
271
272           --mergeinfo=<mergeinfo>
273               Add the given merge information during the dcommit (e.g.
274               --mergeinfo="/branches/foo:1-10"). All svn server versions can
275               store this information (as a property), and svn clients
276               starting from version 1.5 can make use of it. To specify merge
277               information from multiple branches, use a single space
278               character between the branches (--mergeinfo="/branches/foo:1-10
279               /branches/bar:3,5-6,8")
280
281                   config key: svn.pushmergeinfo
282               This option will cause git-svn to attempt to automatically
283               populate the svn:mergeinfo property in the SVN repository when
284               possible. Currently, this can only be done when dcommitting
285               non-fast-forward merges where all parents but the first have
286               already been pushed into SVN.
287
288           --interactive
289               Ask the user to confirm that a patch set should actually be
290               sent to SVN. For each patch, one may answer "yes" (accept this
291               patch), "no" (discard this patch), "all" (accept all patches),
292               or "quit".
293
294               git svn dcommit returns immediately if answer is "no" or
295               "quit", without committing anything to SVN.
296
297       branch
298           Create a branch in the SVN repository.
299
300           -m, --message
301               Allows to specify the commit message.
302
303           -t, --tag
304               Create a tag by using the tags_subdir instead of the
305               branches_subdir specified during git svn init.
306
307           -d<path>, --destination=<path>
308               If more than one --branches (or --tags) option was given to the
309               init or clone command, you must provide the location of the
310               branch (or tag) you wish to create in the SVN repository.
311               <path> specifies which path to use to create the branch or tag
312               and should match the pattern on the left-hand side of one of
313               the configured branches or tags refspecs. You can see these
314               refspecs with the commands
315
316                   git config --get-all svn-remote.<name>.branches
317                   git config --get-all svn-remote.<name>.tags
318
319               where <name> is the name of the SVN repository as specified by
320               the -R option to init (or "svn" by default).
321
322           --username
323               Specify the SVN username to perform the commit as. This option
324               overrides the username configuration property.
325
326           --commit-url
327               Use the specified URL to connect to the destination Subversion
328               repository. This is useful in cases where the source SVN
329               repository is read-only. This option overrides configuration
330               property commiturl.
331
332                   git config --get-all svn-remote.<name>.commiturl
333
334           --parents
335               Create parent folders. This parameter is equivalent to the
336               parameter --parents on svn cp commands and is useful for
337               non-standard repository layouts.
338
339       tag
340           Create a tag in the SVN repository. This is a shorthand for branch
341           -t.
342
343       log
344           This should make it easy to look up svn log messages when svn users
345           refer to -r/--revision numbers.
346
347           The following features from “svn log” are supported:
348
349           -r <n>[:<n>], --revision=<n>[:<n>]
350               is supported, non-numeric args are not: HEAD, NEXT, BASE, PREV,
351               etc ...
352
353           -v, --verbose
354               it’s not completely compatible with the --verbose output in svn
355               log, but reasonably close.
356
357           --limit=<n>
358               is NOT the same as --max-count, doesn’t count merged/excluded
359               commits
360
361           --incremental
362               supported
363
364           New features:
365
366           --show-commit
367               shows the Git commit sha1, as well
368
369           --oneline
370               our version of --pretty=oneline
371
372
373               Note
374               SVN itself only stores times in UTC and nothing else. The
375               regular svn client converts the UTC time to the local time (or
376               based on the TZ= environment). This command has the same
377               behaviour.
378           Any other arguments are passed directly to git log
379
380       blame
381           Show what revision and author last modified each line of a file.
382           The output of this mode is format-compatible with the output of
383           “svn blame” by default. Like the SVN blame command, local
384           uncommitted changes in the working tree are ignored; the version of
385           the file in the HEAD revision is annotated. Unknown arguments are
386           passed directly to git blame.
387
388           --git-format
389               Produce output in the same format as git blame, but with SVN
390               revision numbers instead of Git commit hashes. In this mode,
391               changes that haven’t been committed to SVN (including local
392               working-copy edits) are shown as revision 0.
393
394       find-rev
395           When given an SVN revision number of the form rN, returns the
396           corresponding Git commit hash (this can optionally be followed by a
397           tree-ish to specify which branch should be searched). When given a
398           tree-ish, returns the corresponding SVN revision number.
399
400           -B, --before
401               Don’t require an exact match if given an SVN revision, instead
402               find the commit corresponding to the state of the SVN
403               repository (on the current branch) at the specified revision.
404
405           -A, --after
406               Don’t require an exact match if given an SVN revision; if there
407               is not an exact match return the closest match searching
408               forward in the history.
409
410       set-tree
411           You should consider using dcommit instead of this command. Commit
412           specified commit or tree objects to SVN. This relies on your
413           imported fetch data being up to date. This makes absolutely no
414           attempts to do patching when committing to SVN, it simply
415           overwrites files with those specified in the tree or commit. All
416           merging is assumed to have taken place independently of git svn
417           functions.
418
419       create-ignore
420           Recursively finds the svn:ignore property on directories and
421           creates matching .gitignore files. The resulting files are staged
422           to be committed, but are not committed. Use -r/--revision to refer
423           to a specific revision.
424
425       show-ignore
426           Recursively finds and lists the svn:ignore property on directories.
427           The output is suitable for appending to the $GIT_DIR/info/exclude
428           file.
429
430       mkdirs
431           Attempts to recreate empty directories that core Git cannot track
432           based on information in $GIT_DIR/svn/<refname>/unhandled.log files.
433           Empty directories are automatically recreated when using "git svn
434           clone" and "git svn rebase", so "mkdirs" is intended for use after
435           commands like "git checkout" or "git reset". (See the
436           svn-remote.<name>.automkdirs config file option for more
437           information.)
438
439       commit-diff
440           Commits the diff of two tree-ish arguments from the command-line.
441           This command does not rely on being inside a git svn init-ed
442           repository. This command takes three arguments, (a) the original
443           tree to diff against, (b) the new tree result, (c) the URL of the
444           target Subversion repository. The final argument (URL) may be
445           omitted if you are working from a git svn-aware repository (that
446           has been init-ed with git svn). The -r<revision> option is required
447           for this.
448
449           The commit message is supplied either directly with the -m or -F
450           option, or indirectly from the tag or commit when the second
451           tree-ish denotes such an object, or it is requested by invoking an
452           editor (see --edit option below).
453
454           -m <msg>, --message=<msg>
455               Use the given msg as the commit message. This option disables
456               the --edit option.
457
458           -F <filename>, --file=<filename>
459               Take the commit message from the given file. This option
460               disables the --edit option.
461
462       info
463           Shows information about a file or directory similar to what “svn
464           info” provides. Does not currently support a -r/--revision
465           argument. Use the --url option to output only the value of the URL:
466           field.
467
468       proplist
469           Lists the properties stored in the Subversion repository about a
470           given file or directory. Use -r/--revision to refer to a specific
471           Subversion revision.
472
473       propget
474           Gets the Subversion property given as the first argument, for a
475           file. A specific revision can be specified with -r/--revision.
476
477       propset
478           Sets the Subversion property given as the first argument, to the
479           value given as the second argument for the file given as the third
480           argument.
481
482           Example:
483
484               git svn propset svn:keywords "FreeBSD=%H" devel/py-tipper/Makefile
485
486           This will set the property svn:keywords to FreeBSD=%H for the file
487           devel/py-tipper/Makefile.
488
489       show-externals
490           Shows the Subversion externals. Use -r/--revision to specify a
491           specific revision.
492
493       gc
494           Compress $GIT_DIR/svn/<refname>/unhandled.log files and remove
495           $GIT_DIR/svn/<refname>/index files.
496
497       reset
498           Undoes the effects of fetch back to the specified revision. This
499           allows you to re-fetch an SVN revision. Normally the contents of an
500           SVN revision should never change and reset should not be necessary.
501           However, if SVN permissions change, or if you alter your
502           --ignore-paths option, a fetch may fail with "not found in commit"
503           (file not previously visible) or "checksum mismatch" (missed a
504           modification). If the problem file cannot be ignored forever (with
505           --ignore-paths) the only way to repair the repo is to use reset.
506
507           Only the rev_map and refs/remotes/git-svn are changed (see
508           $GIT_DIR/svn/**/.rev_map.*  in the FILES section below for
509           details). Follow reset with a fetch and then git reset or git
510           rebase to move local branches onto the new tree.
511
512           -r <n>, --revision=<n>
513               Specify the most recent revision to keep. All later revisions
514               are discarded.
515
516           -p, --parent
517               Discard the specified revision as well, keeping the nearest
518               parent instead.
519
520           Example:
521               Assume you have local changes in "master", but you need to
522               refetch "r2".
523
524                       r1---r2---r3 remotes/git-svn
525                                   \
526                                    A---B master
527
528               Fix the ignore-paths or SVN permissions problem that caused
529               "r2" to be incomplete in the first place. Then:
530
531                   git svn reset -r2 -p
532                   git svn fetch
533
534                       r1---r2'--r3' remotes/git-svn
535                         \
536                          r2---r3---A---B master
537
538               Then fixup "master" with git rebase. Do NOT use git merge or
539               your history will not be compatible with a future dcommit!
540
541                   git rebase --onto remotes/git-svn A^ master
542
543                       r1---r2'--r3' remotes/git-svn
544                                   \
545                                    A'--B' master
546

OPTIONS

548       --shared[=(false|true|umask|group|all|world|everybody)],
549       --template=<template_directory>
550           Only used with the init command. These are passed directly to git
551           init.
552
553       -r <arg>, --revision <arg>
554           Used with the fetch command.
555
556           This allows revision ranges for partial/cauterized history to be
557           supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
558           $NUMBER:HEAD, and BASE:$NUMBER are all supported.
559
560           This can allow you to make partial mirrors when running fetch; but
561           is generally not recommended because history will be skipped and
562           lost.
563
564       -, --stdin
565           Only used with the set-tree command.
566
567           Read a list of commits from stdin and commit them in reverse order.
568           Only the leading sha1 is read from each line, so git rev-list
569           --pretty=oneline output can be used.
570
571       --rmdir
572           Only used with the dcommit, set-tree and commit-diff commands.
573
574           Remove directories from the SVN tree if there are no files left
575           behind. SVN can version empty directories, and they are not removed
576           by default if there are no files left in them. Git cannot version
577           empty directories. Enabling this flag will make the commit to SVN
578           act like Git.
579
580               config key: svn.rmdir
581
582       -e, --edit
583           Only used with the dcommit, set-tree and commit-diff commands.
584
585           Edit the commit message before committing to SVN. This is off by
586           default for objects that are commits, and forced on when committing
587           tree objects.
588
589               config key: svn.edit
590
591       -l<num>, --find-copies-harder
592           Only used with the dcommit, set-tree and commit-diff commands.
593
594           They are both passed directly to git diff-tree; see git-diff-
595           tree(1) for more information.
596
597               config key: svn.l
598               config key: svn.findcopiesharder
599
600       -A<filename>, --authors-file=<filename>
601           Syntax is compatible with the file used by git cvsimport but an
602           empty email address can be supplied with <>:
603
604                       loginname = Joe User <user@example.com>
605
606           If this option is specified and git svn encounters an SVN committer
607           name that does not exist in the authors-file, git svn will abort
608           operation. The user will then have to add the appropriate entry.
609           Re-running the previous git svn command after the authors-file is
610           modified should continue operation.
611
612               config key: svn.authorsfile
613
614       --authors-prog=<filename>
615           If this option is specified, for each SVN committer name that does
616           not exist in the authors file, the given file is executed with the
617           committer name as the first argument. The program is expected to
618           return a single line of the form "Name <email>" or "Name <>", which
619           will be treated as if included in the authors file.
620
621           Due to historical reasons a relative filename is first searched
622           relative to the current directory for init and clone and relative
623           to the root of the working tree for fetch. If filename is not
624           found, it is searched like any other command in $PATH.
625
626               config key: svn.authorsProg
627
628       -q, --quiet
629           Make git svn less verbose. Specify a second time to make it even
630           less verbose.
631
632       -m, --merge, -s<strategy>, --strategy=<strategy>, -p, --rebase-merges,
633       --preserve-merges (DEPRECATED)
634           These are only used with the dcommit and rebase commands.
635
636           Passed directly to git rebase when using dcommit if a git reset
637           cannot be used (see dcommit).
638
639       -n, --dry-run
640           This can be used with the dcommit, rebase, branch and tag commands.
641
642           For dcommit, print out the series of Git arguments that would show
643           which diffs would be committed to SVN.
644
645           For rebase, display the local branch associated with the upstream
646           svn repository associated with the current branch and the URL of
647           svn repository that will be fetched from.
648
649           For branch and tag, display the urls that will be used for copying
650           when creating the branch or tag.
651
652       --use-log-author
653           When retrieving svn commits into Git (as part of fetch, rebase, or
654           dcommit operations), look for the first From: line or Signed-off-by
655           trailer in the log message and use that as the author string.
656
657               config key: svn.useLogAuthor
658
659       --add-author-from
660           When committing to svn from Git (as part of set-tree or dcommit
661           operations), if the existing log message doesn’t already have a
662           From: or Signed-off-by trailer, append a From: line based on the
663           Git commit’s author string. If you use this, then --use-log-author
664           will retrieve a valid author string for all commits.
665
666               config key: svn.addAuthorFrom
667

ADVANCED OPTIONS

669       -i<GIT_SVN_ID>, --id <GIT_SVN_ID>
670           This sets GIT_SVN_ID (instead of using the environment). This
671           allows the user to override the default refname to fetch from when
672           tracking a single URL. The log and dcommit commands no longer
673           require this switch as an argument.
674
675       -R<remote name>, --svn-remote <remote name>
676           Specify the [svn-remote "<remote name>"] section to use, this
677           allows SVN multiple repositories to be tracked. Default: "svn"
678
679       --follow-parent
680           This option is only relevant if we are tracking branches (using one
681           of the repository layout options --trunk, --tags, --branches,
682           --stdlayout). For each tracked branch, try to find out where its
683           revision was copied from, and set a suitable parent in the first
684           Git commit for the branch. This is especially helpful when we’re
685           tracking a directory that has been moved around within the
686           repository. If this feature is disabled, the branches created by
687           git svn will all be linear and not share any history, meaning that
688           there will be no information on where branches were branched off or
689           merged. However, following long/convoluted histories can take a
690           long time, so disabling this feature may speed up the cloning
691           process. This feature is enabled by default, use --no-follow-parent
692           to disable it.
693
694               config key: svn.followparent
695

CONFIG FILE-ONLY OPTIONS

697       svn.noMetadata, svn-remote.<name>.noMetadata
698           This gets rid of the git-svn-id: lines at the end of every commit.
699
700           This option can only be used for one-shot imports as git svn will
701           not be able to fetch again without metadata. Additionally, if you
702           lose your $GIT_DIR/svn/**/.rev_map.*  files, git svn will not be
703           able to rebuild them.
704
705           The git svn log command will not work on repositories using this,
706           either. Using this conflicts with the useSvmProps option for
707           (hopefully) obvious reasons.
708
709           This option is NOT recommended as it makes it difficult to track
710           down old references to SVN revision numbers in existing
711           documentation, bug reports, and archives. If you plan to eventually
712           migrate from SVN to Git and are certain about dropping SVN history,
713           consider git-filter-repo[1] instead. filter-repo also allows
714           reformatting of metadata for ease-of-reading and rewriting
715           authorship info for non-"svn.authorsFile" users.
716
717       svn.useSvmProps, svn-remote.<name>.useSvmProps
718           This allows git svn to re-map repository URLs and UUIDs from
719           mirrors created using SVN::Mirror (or svk) for metadata.
720
721           If an SVN revision has a property, "svm:headrev", it is likely that
722           the revision was created by SVN::Mirror (also used by SVK). The
723           property contains a repository UUID and a revision. We want to make
724           it look like we are mirroring the original URL, so introduce a
725           helper function that returns the original identity URL and UUID,
726           and use it when generating metadata in commit messages.
727
728       svn.useSvnsyncProps, svn-remote.<name>.useSvnsyncprops
729           Similar to the useSvmProps option; this is for users of the
730           svnsync(1) command distributed with SVN 1.4.x and later.
731
732       svn-remote.<name>.rewriteRoot
733           This allows users to create repositories from alternate URLs. For
734           example, an administrator could run git svn on the server locally
735           (accessing via file://) but wish to distribute the repository with
736           a public http:// or svn:// URL in the metadata so users of it will
737           see the public URL.
738
739       svn-remote.<name>.rewriteUUID
740           Similar to the useSvmProps option; this is for users who need to
741           remap the UUID manually. This may be useful in situations where the
742           original UUID is not available via either useSvmProps or
743           useSvnsyncProps.
744
745       svn-remote.<name>.pushurl
746           Similar to Git’s remote.<name>.pushurl, this key is designed to be
747           used in cases where url points to an SVN repository via a read-only
748           transport, to provide an alternate read/write transport. It is
749           assumed that both keys point to the same repository. Unlike
750           commiturl, pushurl is a base path. If either commiturl or pushurl
751           could be used, commiturl takes precedence.
752
753       svn.brokenSymlinkWorkaround
754           This disables potentially expensive checks to workaround broken
755           symlinks checked into SVN by broken clients. Set this option to
756           "false" if you track a SVN repository with many empty blobs that
757           are not symlinks. This option may be changed while git svn is
758           running and take effect on the next revision fetched. If unset, git
759           svn assumes this option to be "true".
760
761       svn.pathnameencoding
762           This instructs git svn to recode pathnames to a given encoding. It
763           can be used by windows users and by those who work in non-utf8
764           locales to avoid corrupted file names with non-ASCII characters.
765           Valid encodings are the ones supported by Perl’s Encode module.
766
767       svn-remote.<name>.automkdirs
768           Normally, the "git svn clone" and "git svn rebase" commands attempt
769           to recreate empty directories that are in the Subversion
770           repository. If this option is set to "false", then empty
771           directories will only be created if the "git svn mkdirs" command is
772           run explicitly. If unset, git svn assumes this option to be "true".
773
774       Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and
775       useSvmProps options all affect the metadata generated and used by git
776       svn; they must be set in the configuration file before any history is
777       imported and these settings should never be changed once they are set.
778
779       Additionally, only one of these options can be used per svn-remote
780       section because they affect the git-svn-id: metadata line, except for
781       rewriteRoot and rewriteUUID which can be used together.
782

BASIC EXAMPLES

784       Tracking and contributing to the trunk of a Subversion-managed project
785       (ignoring tags and branches):
786
787           # Clone a repo (like git clone):
788                   git svn clone http://svn.example.com/project/trunk
789           # Enter the newly cloned directory:
790                   cd trunk
791           # You should be on master branch, double-check with 'git branch'
792                   git branch
793           # Do some work and commit locally to Git:
794                   git commit ...
795           # Something is committed to SVN, rebase your local changes against the
796           # latest changes in SVN:
797                   git svn rebase
798           # Now commit your changes (that were committed previously using Git) to SVN,
799           # as well as automatically updating your working HEAD:
800                   git svn dcommit
801           # Append svn:ignore settings to the default Git exclude file:
802                   git svn show-ignore >> .git/info/exclude
803
804       Tracking and contributing to an entire Subversion-managed project
805       (complete with a trunk, tags and branches):
806
807           # Clone a repo with standard SVN directory layout (like git clone):
808                   git svn clone http://svn.example.com/project --stdlayout --prefix svn/
809           # Or, if the repo uses a non-standard directory layout:
810                   git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/
811           # View all branches and tags you have cloned:
812                   git branch -r
813           # Create a new branch in SVN
814                   git svn branch waldo
815           # Reset your master to trunk (or any other branch, replacing 'trunk'
816           # with the appropriate name):
817                   git reset --hard svn/trunk
818           # You may only dcommit to one branch/tag/trunk at a time.  The usage
819           # of dcommit/rebase/show-ignore should be the same as above.
820
821       The initial git svn clone can be quite time-consuming (especially for
822       large Subversion repositories). If multiple people (or one person with
823       multiple machines) want to use git svn to interact with the same
824       Subversion repository, you can do the initial git svn clone to a
825       repository on a server and have each person clone that repository with
826       git clone:
827
828           # Do the initial import on a server
829                   ssh server "cd /pub && git svn clone http://svn.example.com/project [options...]"
830           # Clone locally - make sure the refs/remotes/ space matches the server
831                   mkdir project
832                   cd project
833                   git init
834                   git remote add origin server:/pub/project
835                   git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
836                   git fetch
837           # Prevent fetch/pull from remote Git server in the future,
838           # we only want to use git svn for future updates
839                   git config --remove-section remote.origin
840           # Create a local branch from one of the branches just fetched
841                   git checkout -b master FETCH_HEAD
842           # Initialize 'git svn' locally (be sure to use the same URL and
843           # --stdlayout/-T/-b/-t/--prefix options as were used on server)
844                   git svn init http://svn.example.com/project [options...]
845           # Pull the latest changes from Subversion
846                   git svn rebase
847

REBASE VS. PULL/MERGE

849       Prefer to use git svn rebase or git rebase, rather than git pull or git
850       merge to synchronize unintegrated commits with a git svn branch. Doing
851       so will keep the history of unintegrated commits linear with respect to
852       the upstream SVN repository and allow the use of the preferred git svn
853       dcommit subcommand to push unintegrated commits back into SVN.
854
855       Originally, git svn recommended that developers pulled or merged from
856       the git svn branch. This was because the author favored git svn
857       set-tree B to commit a single head rather than the git svn set-tree
858       A..B notation to commit multiple commits. Use of git pull or git merge
859       with git svn set-tree A..B will cause non-linear history to be
860       flattened when committing into SVN and this can lead to merge commits
861       unexpectedly reversing previous commits in SVN.
862

MERGE TRACKING

864       While git svn can track copy history (including branches and tags) for
865       repositories adopting a standard layout, it cannot yet represent merge
866       history that happened inside git back upstream to SVN users. Therefore
867       it is advised that users keep history as linear as possible inside Git
868       to ease compatibility with SVN (see the CAVEATS section below).
869

HANDLING OF SVN BRANCHES

871       If git svn is configured to fetch branches (and --follow-branches is in
872       effect), it sometimes creates multiple Git branches for one SVN branch,
873       where the additional branches have names of the form branchname@nnn
874       (with nnn an SVN revision number). These additional branches are
875       created if git svn cannot find a parent commit for the first commit in
876       an SVN branch, to connect the branch to the history of the other
877       branches.
878
879       Normally, the first commit in an SVN branch consists of a copy
880       operation. git svn will read this commit to get the SVN revision the
881       branch was created from. It will then try to find the Git commit that
882       corresponds to this SVN revision, and use that as the parent of the
883       branch. However, it is possible that there is no suitable Git commit to
884       serve as parent. This will happen, among other reasons, if the SVN
885       branch is a copy of a revision that was not fetched by git svn (e.g.
886       because it is an old revision that was skipped with --revision), or if
887       in SVN a directory was copied that is not tracked by git svn (such as a
888       branch that is not tracked at all, or a subdirectory of a tracked
889       branch). In these cases, git svn will still create a Git branch, but
890       instead of using an existing Git commit as the parent of the branch, it
891       will read the SVN history of the directory the branch was copied from
892       and create appropriate Git commits. This is indicated by the message
893       "Initializing parent: <branchname>".
894
895       Additionally, it will create a special branch named
896       <branchname>@<SVN-Revision>, where <SVN-Revision> is the SVN revision
897       number the branch was copied from. This branch will point to the newly
898       created parent commit of the branch. If in SVN the branch was deleted
899       and later recreated from a different version, there will be multiple
900       such branches with an @.
901
902       Note that this may mean that multiple Git commits are created for a
903       single SVN revision.
904
905       An example: in an SVN repository with a standard trunk/tags/branches
906       layout, a directory trunk/sub is created in r.100. In r.200, trunk/sub
907       is branched by copying it to branches/. git svn clone -s will then
908       create a branch sub. It will also create new Git commits for r.100
909       through r.199 and use these as the history of branch sub. Thus there
910       will be two Git commits for each revision from r.100 to r.199 (one
911       containing trunk/, one containing trunk/sub/). Finally, it will create
912       a branch sub@200 pointing to the new parent commit of branch sub (i.e.
913       the commit for r.200 and trunk/sub/).
914

CAVEATS

916       For the sake of simplicity and interoperating with Subversion, it is
917       recommended that all git svn users clone, fetch and dcommit directly
918       from the SVN server, and avoid all git clone/pull/merge/push operations
919       between Git repositories and branches. The recommended method of
920       exchanging code between Git branches and users is git format-patch and
921       git am, or just 'dcommit’ing to the SVN repository.
922
923       Running git merge or git pull is NOT recommended on a branch you plan
924       to dcommit from because Subversion users cannot see any merges you’ve
925       made. Furthermore, if you merge or pull from a Git branch that is a
926       mirror of an SVN branch, dcommit may commit to the wrong branch.
927
928       If you do merge, note the following rule: git svn dcommit will attempt
929       to commit on top of the SVN commit named in
930
931           git log --grep=^git-svn-id: --first-parent -1
932
933       You must therefore ensure that the most recent commit of the branch you
934       want to dcommit to is the first parent of the merge. Chaos will ensue
935       otherwise, especially if the first parent is an older commit on the
936       same SVN branch.
937
938       git clone does not clone branches under the refs/remotes/ hierarchy or
939       any git svn metadata, or config. So repositories created and managed
940       with using git svn should use rsync for cloning, if cloning is to be
941       done at all.
942
943       Since dcommit uses rebase internally, any Git branches you git push to
944       before dcommit on will require forcing an overwrite of the existing ref
945       on the remote repository. This is generally considered bad practice,
946       see the git-push(1) documentation for details.
947
948       Do not use the --amend option of git-commit(1) on a change you’ve
949       already dcommitted. It is considered bad practice to --amend commits
950       you’ve already pushed to a remote repository for other users, and
951       dcommit with SVN is analogous to that.
952
953       When cloning an SVN repository, if none of the options for describing
954       the repository layout is used (--trunk, --tags, --branches,
955       --stdlayout), git svn clone will create a Git repository with
956       completely linear history, where branches and tags appear as separate
957       directories in the working copy. While this is the easiest way to get a
958       copy of a complete repository, for projects with many branches it will
959       lead to a working copy many times larger than just the trunk. Thus for
960       projects using the standard directory structure (trunk/branches/tags),
961       it is recommended to clone with option --stdlayout. If the project uses
962       a non-standard structure, and/or if branches and tags are not required,
963       it is easiest to only clone one directory (typically trunk), without
964       giving any repository layout options. If the full history with branches
965       and tags is required, the options --trunk / --branches / --tags must be
966       used.
967
968       When using multiple --branches or --tags, git svn does not
969       automatically handle name collisions (for example, if two branches from
970       different paths have the same name, or if a branch and a tag have the
971       same name). In these cases, use init to set up your Git repository
972       then, before your first fetch, edit the $GIT_DIR/config file so that
973       the branches and tags are associated with different name spaces. For
974       example:
975
976           branches = stable/*:refs/remotes/svn/stable/*
977           branches = debug/*:refs/remotes/svn/debug/*
978

BUGS

980       We ignore all SVN properties except svn:executable. Any unhandled
981       properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
982
983       Renamed and copied directories are not detected by Git and hence not
984       tracked when committing to SVN. I do not plan on adding support for
985       this as it’s quite difficult and time-consuming to get working for all
986       the possible corner cases (Git doesn’t do it, either). Committing
987       renamed and copied files is fully supported if they’re similar enough
988       for Git to detect them.
989
990       In SVN, it is possible (though discouraged) to commit changes to a tag
991       (because a tag is just a directory copy, thus technically the same as a
992       branch). When cloning an SVN repository, git svn cannot know if such a
993       commit to a tag will happen in the future. Thus it acts conservatively
994       and imports all SVN tags as branches, prefixing the tag name with
995       tags/.
996

CONFIGURATION

998       git svn stores [svn-remote] configuration information in the repository
999       $GIT_DIR/config file. It is similar the core Git [remote] sections
1000       except fetch keys do not accept glob arguments; but they are instead
1001       handled by the branches and tags keys. Since some SVN repositories are
1002       oddly configured with multiple projects glob expansions such those
1003       listed below are allowed:
1004
1005           [svn-remote "project-a"]
1006                   url = http://server.org/svn
1007                   fetch = trunk/project-a:refs/remotes/project-a/trunk
1008                   branches = branches/*/project-a:refs/remotes/project-a/branches/*
1009                   branches = branches/release_*:refs/remotes/project-a/branches/release_*
1010                   branches = branches/re*se:refs/remotes/project-a/branches/*
1011                   tags = tags/*/project-a:refs/remotes/project-a/tags/*
1012
1013       Keep in mind that the * (asterisk) wildcard of the local ref (right of
1014       the :) must be the farthest right path component; however the remote
1015       wildcard may be anywhere as long as it’s an independent path component
1016       (surrounded by / or EOL). This type of configuration is not
1017       automatically created by init and should be manually entered with a
1018       text-editor or using git config.
1019
1020       Also note that only one asterisk is allowed per word. For example:
1021
1022           branches = branches/re*se:refs/remotes/project-a/branches/*
1023
1024       will match branches release, rese, re123se, however
1025
1026           branches = branches/re*s*e:refs/remotes/project-a/branches/*
1027
1028       will produce an error.
1029
1030       It is also possible to fetch a subset of branches or tags by using a
1031       comma-separated list of names within braces. For example:
1032
1033           [svn-remote "huge-project"]
1034                   url = http://server.org/svn
1035                   fetch = trunk/src:refs/remotes/trunk
1036                   branches = branches/{red,green}/src:refs/remotes/project-a/branches/*
1037                   tags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/*
1038
1039       Multiple fetch, branches, and tags keys are supported:
1040
1041           [svn-remote "messy-repo"]
1042                   url = http://server.org/svn
1043                   fetch = trunk/project-a:refs/remotes/project-a/trunk
1044                   fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
1045                   branches = branches/server/*:refs/remotes/project-a/branches/*
1046                   branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*
1047                   tags = tags/server/*:refs/remotes/project-a/tags/*
1048
1049       Creating a branch in such a configuration requires disambiguating which
1050       location to use using the -d or --destination flag:
1051
1052           $ git svn branch -d branches/server release-2-3-0
1053
1054       Note that git-svn keeps track of the highest revision in which a branch
1055       or tag has appeared. If the subset of branches or tags is changed after
1056       fetching, then $GIT_DIR/svn/.metadata must be manually edited to remove
1057       (or reset) branches-maxRev and/or tags-maxRev as appropriate.
1058

FILES

1060       $GIT_DIR/svn/**/.rev_map.*
1061           Mapping between Subversion revision numbers and Git commit names.
1062           In a repository where the noMetadata option is not set, this can be
1063           rebuilt from the git-svn-id: lines that are at the end of every
1064           commit (see the svn.noMetadata section above for details).
1065
1066           git svn fetch and git svn rebase automatically update the rev_map
1067           if it is missing or not up to date.  git svn reset automatically
1068           rewinds it.
1069

SEE ALSO

1071       git-rebase(1)
1072

GIT

1074       Part of the git(1) suite
1075

NOTES

1077        1. git-filter-repo
1078           https://github.com/newren/git-filter-repo
1079
1080
1081
1082Git 2.31.1                        2021-03-26                        GIT-SVN(1)
Impressum