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           These are only used with the dcommit and rebase commands.
634
635           Passed directly to git rebase when using dcommit if a git reset
636           cannot be used (see dcommit).
637
638       -n, --dry-run
639           This can be used with the dcommit, rebase, branch and tag commands.
640
641           For dcommit, print out the series of Git arguments that would show
642           which diffs would be committed to SVN.
643
644           For rebase, display the local branch associated with the upstream
645           svn repository associated with the current branch and the URL of
646           svn repository that will be fetched from.
647
648           For branch and tag, display the urls that will be used for copying
649           when creating the branch or tag.
650
651       --use-log-author
652           When retrieving svn commits into Git (as part of fetch, rebase, or
653           dcommit operations), look for the first From: line or Signed-off-by
654           trailer in the log message and use that as the author string.
655
656               config key: svn.useLogAuthor
657
658       --add-author-from
659           When committing to svn from Git (as part of set-tree or dcommit
660           operations), if the existing log message doesn’t already have a
661           From: or Signed-off-by trailer, append a From: line based on the
662           Git commit’s author string. If you use this, then --use-log-author
663           will retrieve a valid author string for all commits.
664
665               config key: svn.addAuthorFrom
666

ADVANCED OPTIONS

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

CONFIG FILE-ONLY OPTIONS

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

BASIC EXAMPLES

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

REBASE VS. PULL/MERGE

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

MERGE TRACKING

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

HANDLING OF SVN BRANCHES

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

CAVEATS

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

CONFIGURATION

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

FILES

1041       $GIT_DIR/svn/**/.rev_map.*
1042           Mapping between Subversion revision numbers and Git commit names.
1043           In a repository where the noMetadata option is not set, this can be
1044           rebuilt from the git-svn-id: lines that are at the end of every
1045           commit (see the svn.noMetadata section above for details).
1046
1047           git svn fetch and git svn rebase automatically update the rev_map
1048           if it is missing or not up to date.  git svn reset automatically
1049           rewinds it.
1050

BUGS

1052       We ignore all SVN properties except svn:executable. Any unhandled
1053       properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
1054
1055       Renamed and copied directories are not detected by Git and hence not
1056       tracked when committing to SVN. I do not plan on adding support for
1057       this as it’s quite difficult and time-consuming to get working for all
1058       the possible corner cases (Git doesn’t do it, either). Committing
1059       renamed and copied files is fully supported if they’re similar enough
1060       for Git to detect them.
1061
1062       In SVN, it is possible (though discouraged) to commit changes to a tag
1063       (because a tag is just a directory copy, thus technically the same as a
1064       branch). When cloning an SVN repository, git svn cannot know if such a
1065       commit to a tag will happen in the future. Thus it acts conservatively
1066       and imports all SVN tags as branches, prefixing the tag name with
1067       tags/.
1068

SEE ALSO

1070       git-rebase(1)
1071

GIT

1073       Part of the git(1) suite
1074

NOTES

1076        1. git-filter-repo
1077           https://github.com/newren/git-filter-repo
1078
1079
1080
1081Git 2.39.1                        2023-01-13                        GIT-SVN(1)
Impressum