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
12

DESCRIPTION

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

COMMANDS

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

OPTIONS

486       --shared[=(false|true|umask|group|all|world|everybody)],
487       --template=<template_directory>
488           Only used with the init command. These are passed directly to git
489           init.
490
491       -r <arg>, --revision <arg>
492           Used with the fetch command.
493
494           This allows revision ranges for partial/cauterized history to be
495           supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
496           $NUMBER:HEAD, and BASE:$NUMBER are all supported.
497
498           This can allow you to make partial mirrors when running fetch; but
499           is generally not recommended because history will be skipped and
500           lost.
501
502       -, --stdin
503           Only used with the set-tree command.
504
505           Read a list of commits from stdin and commit them in reverse order.
506           Only the leading sha1 is read from each line, so git rev-list
507           --pretty=oneline output can be used.
508
509       --rmdir
510           Only used with the dcommit, set-tree and commit-diff commands.
511
512           Remove directories from the SVN tree if there are no files left
513           behind. SVN can version empty directories, and they are not removed
514           by default if there are no files left in them. Git cannot version
515           empty directories. Enabling this flag will make the commit to SVN
516           act like Git.
517
518               config key: svn.rmdir
519
520
521       -e, --edit
522           Only used with the dcommit, set-tree and commit-diff commands.
523
524           Edit the commit message before committing to SVN. This is off by
525           default for objects that are commits, and forced on when committing
526           tree objects.
527
528               config key: svn.edit
529
530
531       -l<num>, --find-copies-harder
532           Only used with the dcommit, set-tree and commit-diff commands.
533
534           They are both passed directly to git diff-tree; see git-diff-
535           tree(1) for more information.
536
537               config key: svn.l
538               config key: svn.findcopiesharder
539
540
541       -A<filename>, --authors-file=<filename>
542           Syntax is compatible with the file used by git cvsimport:
543
544                       loginname = Joe User <user@example.com>
545
546           If this option is specified and git svn encounters an SVN committer
547           name that does not exist in the authors-file, git svn will abort
548           operation. The user will then have to add the appropriate entry.
549           Re-running the previous git svn command after the authors-file is
550           modified should continue operation.
551
552               config key: svn.authorsfile
553
554
555       --authors-prog=<filename>
556           If this option is specified, for each SVN committer name that does
557           not exist in the authors file, the given file is executed with the
558           committer name as the first argument. The program is expected to
559           return a single line of the form "Name <email>", which will be
560           treated as if included in the authors file.
561
562       -q, --quiet
563           Make git svn less verbose. Specify a second time to make it even
564           less verbose.
565
566       --repack[=<n>], --repack-flags=<flags>
567           These should help keep disk usage sane for large fetches with many
568           revisions.
569
570           --repack takes an optional argument for the number of revisions to
571           fetch before repacking. This defaults to repacking every 1000
572           commits fetched if no argument is specified.
573
574           --repack-flags are passed directly to git repack.
575
576               config key: svn.repack
577               config key: svn.repackflags
578
579
580       -m, --merge, -s<strategy>, --strategy=<strategy>, -p, --preserve-merges
581           These are only used with the dcommit and rebase commands.
582
583           Passed directly to git rebase when using dcommit if a git reset
584           cannot be used (see dcommit).
585
586       -n, --dry-run
587           This can be used with the dcommit, rebase, branch and tag commands.
588
589           For dcommit, print out the series of Git arguments that would show
590           which diffs would be committed to SVN.
591
592           For rebase, display the local branch associated with the upstream
593           svn repository associated with the current branch and the URL of
594           svn repository that will be fetched from.
595
596           For branch and tag, display the urls that will be used for copying
597           when creating the branch or tag.
598
599       --use-log-author
600           When retrieving svn commits into Git (as part of fetch, rebase, or
601           dcommit operations), look for the first From: or Signed-off-by:
602           line in the log message and use that as the author string.
603
604       --add-author-from
605           When committing to svn from Git (as part of commit-diff, set-tree
606           or dcommit operations), if the existing log message doesn’t already
607           have a From: or Signed-off-by: line, append a From: line based on
608           the Git commit’s author string. If you use this, then
609           --use-log-author will retrieve a valid author string for all
610           commits.
611

ADVANCED OPTIONS

613       -i<GIT_SVN_ID>, --id <GIT_SVN_ID>
614           This sets GIT_SVN_ID (instead of using the environment). This
615           allows the user to override the default refname to fetch from when
616           tracking a single URL. The log and dcommit commands no longer
617           require this switch as an argument.
618
619       -R<remote name>, --svn-remote <remote name>
620           Specify the [svn-remote "<remote name>"] section to use, this
621           allows SVN multiple repositories to be tracked. Default: "svn"
622
623       --follow-parent
624           This option is only relevant if we are tracking branches (using one
625           of the repository layout options --trunk, --tags, --branches,
626           --stdlayout). For each tracked branch, try to find out where its
627           revision was copied from, and set a suitable parent in the first
628           Git commit for the branch. This is especially helpful when we’re
629           tracking a directory that has been moved around within the
630           repository. If this feature is disabled, the branches created by
631           git svn will all be linear and not share any history, meaning that
632           there will be no information on where branches were branched off or
633           merged. However, following long/convoluted histories can take a
634           long time, so disabling this feature may speed up the cloning
635           process. This feature is enabled by default, use --no-follow-parent
636           to disable it.
637
638               config key: svn.followparent
639
640

CONFIG FILE-ONLY OPTIONS

642       svn.noMetadata, svn-remote.<name>.noMetadata
643           This gets rid of the git-svn-id: lines at the end of every commit.
644
645           This option can only be used for one-shot imports as git svn will
646           not be able to fetch again without metadata. Additionally, if you
647           lose your .git/svn/*/.rev_map.  files, git svn will not be able to
648           rebuild them.
649
650           The git svn log command will not work on repositories using this,
651           either. Using this conflicts with the useSvmProps option for
652           (hopefully) obvious reasons.
653
654           This option is NOT recommended as it makes it difficult to track
655           down old references to SVN revision numbers in existing
656           documentation, bug reports and archives. If you plan to eventually
657           migrate from SVN to Git and are certain about dropping SVN history,
658           consider git-filter-branch(1) instead. filter-branch also allows
659           reformatting of metadata for ease-of-reading and rewriting
660           authorship info for non-"svn.authorsFile" users.
661
662       svn.useSvmProps, svn-remote.<name>.useSvmProps
663           This allows git svn to re-map repository URLs and UUIDs from
664           mirrors created using SVN::Mirror (or svk) for metadata.
665
666           If an SVN revision has a property, "svm:headrev", it is likely that
667           the revision was created by SVN::Mirror (also used by SVK). The
668           property contains a repository UUID and a revision. We want to make
669           it look like we are mirroring the original URL, so introduce a
670           helper function that returns the original identity URL and UUID,
671           and use it when generating metadata in commit messages.
672
673       svn.useSvnsyncProps, svn-remote.<name>.useSvnsyncprops
674           Similar to the useSvmProps option; this is for users of the
675           svnsync(1) command distributed with SVN 1.4.x and later.
676
677       svn-remote.<name>.rewriteRoot
678           This allows users to create repositories from alternate URLs. For
679           example, an administrator could run git svn on the server locally
680           (accessing via file://) but wish to distribute the repository with
681           a public http:// or svn:// URL in the metadata so users of it will
682           see the public URL.
683
684       svn-remote.<name>.rewriteUUID
685           Similar to the useSvmProps option; this is for users who need to
686           remap the UUID manually. This may be useful in situations where the
687           original UUID is not available via either useSvmProps or
688           useSvnsyncProps.
689
690       svn-remote.<name>.pushurl
691           Similar to Git’s remote.<name>.pushurl, this key is designed to be
692           used in cases where url points to an SVN repository via a read-only
693           transport, to provide an alternate read/write transport. It is
694           assumed that both keys point to the same repository. Unlike
695           commiturl, pushurl is a base path. If either commiturl or pushurl
696           could be used, commiturl takes precedence.
697
698       svn.brokenSymlinkWorkaround
699           This disables potentially expensive checks to workaround broken
700           symlinks checked into SVN by broken clients. Set this option to
701           "false" if you track a SVN repository with many empty blobs that
702           are not symlinks. This option may be changed while git svn is
703           running and take effect on the next revision fetched. If unset, git
704           svn assumes this option to be "true".
705
706       svn.pathnameencoding
707           This instructs git svn to recode pathnames to a given encoding. It
708           can be used by windows users and by those who work in non-utf8
709           locales to avoid corrupted file names with non-ASCII characters.
710           Valid encodings are the ones supported by Perl’s Encode module.
711
712       svn-remote.<name>.automkdirs
713           Normally, the "git svn clone" and "git svn rebase" commands attempt
714           to recreate empty directories that are in the Subversion
715           repository. If this option is set to "false", then empty
716           directories will only be created if the "git svn mkdirs" command is
717           run explicitly. If unset, git svn assumes this option to be "true".
718
719       Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and
720       useSvmProps options all affect the metadata generated and used by git
721       svn; they must be set in the configuration file before any history is
722       imported and these settings should never be changed once they are set.
723
724       Additionally, only one of these options can be used per svn-remote
725       section because they affect the git-svn-id: metadata line, except for
726       rewriteRoot and rewriteUUID which can be used together.
727

BASIC EXAMPLES

729       Tracking and contributing to the trunk of a Subversion-managed project
730       (ignoring tags and branches):
731
732           # Clone a repo (like git clone):
733                   git svn clone http://svn.example.com/project/trunk
734           # Enter the newly cloned directory:
735                   cd trunk
736           # You should be on master branch, double-check with 'git branch'
737                   git branch
738           # Do some work and commit locally to Git:
739                   git commit ...
740           # Something is committed to SVN, rebase your local changes against the
741           # latest changes in SVN:
742                   git svn rebase
743           # Now commit your changes (that were committed previously using Git) to SVN,
744           # as well as automatically updating your working HEAD:
745                   git svn dcommit
746           # Append svn:ignore settings to the default Git exclude file:
747                   git svn show-ignore >> .git/info/exclude
748
749
750       Tracking and contributing to an entire Subversion-managed project
751       (complete with a trunk, tags and branches):
752
753           # Clone a repo with standard SVN directory layout (like git clone):
754                   git svn clone http://svn.example.com/project --stdlayout
755           # Or, if the repo uses a non-standard directory layout:
756                   git svn clone http://svn.example.com/project -T tr -b branch -t tag
757           # View all branches and tags you have cloned:
758                   git branch -r
759           # Create a new branch in SVN
760               git svn branch waldo
761           # Reset your master to trunk (or any other branch, replacing 'trunk'
762           # with the appropriate name):
763                   git reset --hard remotes/trunk
764           # You may only dcommit to one branch/tag/trunk at a time.  The usage
765           # of dcommit/rebase/show-ignore should be the same as above.
766
767
768       The initial git svn clone can be quite time-consuming (especially for
769       large Subversion repositories). If multiple people (or one person with
770       multiple machines) want to use git svn to interact with the same
771       Subversion repository, you can do the initial git svn clone to a
772       repository on a server and have each person clone that repository with
773       git clone:
774
775           # Do the initial import on a server
776                   ssh server "cd /pub && git svn clone http://svn.example.com/project
777           # Clone locally - make sure the refs/remotes/ space matches the server
778                   mkdir project
779                   cd project
780                   git init
781                   git remote add origin server:/pub/project
782                   git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
783                   git fetch
784           # Prevent fetch/pull from remote Git server in the future,
785           # we only want to use git svn for future updates
786                   git config --remove-section remote.origin
787           # Create a local branch from one of the branches just fetched
788                   git checkout -b master FETCH_HEAD
789           # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
790                   git svn init http://svn.example.com/project
791           # Pull the latest changes from Subversion
792                   git svn rebase
793
794

REBASE VS. PULL/MERGE

796       Prefer to use git svn rebase or git rebase, rather than git pull or git
797       merge to synchronize unintegrated commits with a git svn branch. Doing
798       so will keep the history of unintegrated commits linear with respect to
799       the upstream SVN repository and allow the use of the preferred git svn
800       dcommit subcommand to push unintegrated commits back into SVN.
801
802       Originally, git svn recommended that developers pulled or merged from
803       the git svn branch. This was because the author favored git svn
804       set-tree B to commit a single head rather than the git svn set-tree
805       A..B notation to commit multiple commits. Use of git pull or git merge
806       with git svn set-tree A..B will cause non-linear history to be
807       flattened when committing into SVN and this can lead to merge commits
808       unexpectedly reversing previous commits in SVN.
809

MERGE TRACKING

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

HANDLING OF SVN BRANCHES

818       If git svn is configured to fetch branches (and --follow-branches is in
819       effect), it sometimes creates multiple Git branches for one SVN branch,
820       where the additional branches have names of the form branchname@nnn
821       (with nnn an SVN revision number). These additional branches are
822       created if git svn cannot find a parent commit for the first commit in
823       an SVN branch, to connect the branch to the history of the other
824       branches.
825
826       Normally, the first commit in an SVN branch consists of a copy
827       operation. git svn will read this commit to get the SVN revision the
828       branch was created from. It will then try to find the Git commit that
829       corresponds to this SVN revision, and use that as the parent of the
830       branch. However, it is possible that there is no suitable Git commit to
831       serve as parent. This will happen, among other reasons, if the SVN
832       branch is a copy of a revision that was not fetched by git svn (e.g.
833       because it is an old revision that was skipped with --revision), or if
834       in SVN a directory was copied that is not tracked by git svn (such as a
835       branch that is not tracked at all, or a subdirectory of a tracked
836       branch). In these cases, git svn will still create a Git branch, but
837       instead of using an existing Git commit as the parent of the branch, it
838       will read the SVN history of the directory the branch was copied from
839       and create appropriate Git commits. This is indicated by the message
840       "Initializing parent: <branchname>".
841
842       Additionally, it will create a special branch named
843       <branchname>@<SVN-Revision>, where <SVN-Revision> is the SVN revision
844       number the branch was copied from. This branch will point to the newly
845       created parent commit of the branch. If in SVN the branch was deleted
846       and later recreated from a different version, there will be multiple
847       such branches with an @.
848
849       Note that this may mean that multiple Git commits are created for a
850       single SVN revision.
851
852       An example: in an SVN repository with a standard trunk/tags/branches
853       layout, a directory trunk/sub is created in r.100. In r.200, trunk/sub
854       is branched by copying it to branches/. git svn clone -s will then
855       create a branch sub. It will also create new Git commits for r.100
856       through r.199 and use these as the history of branch sub. Thus there
857       will be two Git commits for each revision from r.100 to r.199 (one
858       containing trunk/, one containing trunk/sub/). Finally, it will create
859       a branch sub@200 pointing to the new parent commit of branch sub (i.e.
860       the commit for r.200 and trunk/sub/).
861

CAVEATS

863       For the sake of simplicity and interoperating with Subversion, it is
864       recommended that all git svn users clone, fetch and dcommit directly
865       from the SVN server, and avoid all git clone/pull/merge/push operations
866       between Git repositories and branches. The recommended method of
867       exchanging code between Git branches and users is git format-patch and
868       git am, or just 'dcommit’ing to the SVN repository.
869
870       Running git merge or git pull is NOT recommended on a branch you plan
871       to dcommit from because Subversion users cannot see any merges you’ve
872       made. Furthermore, if you merge or pull from a Git branch that is a
873       mirror of an SVN branch, dcommit may commit to the wrong branch.
874
875       If you do merge, note the following rule: git svn dcommit will attempt
876       to commit on top of the SVN commit named in
877
878           git log --grep=^git-svn-id: --first-parent -1
879
880
881       You must therefore ensure that the most recent commit of the branch you
882       want to dcommit to is the first parent of the merge. Chaos will ensue
883       otherwise, especially if the first parent is an older commit on the
884       same SVN branch.
885
886       git clone does not clone branches under the refs/remotes/ hierarchy or
887       any git svn metadata, or config. So repositories created and managed
888       with using git svn should use rsync for cloning, if cloning is to be
889       done at all.
890
891       Since dcommit uses rebase internally, any Git branches you git push to
892       before dcommit on will require forcing an overwrite of the existing ref
893       on the remote repository. This is generally considered bad practice,
894       see the git-push(1) documentation for details.
895
896       Do not use the --amend option of git-commit(1) on a change you’ve
897       already dcommitted. It is considered bad practice to --amend commits
898       you’ve already pushed to a remote repository for other users, and
899       dcommit with SVN is analogous to that.
900
901       When cloning an SVN repository, if none of the options for describing
902       the repository layout is used (--trunk, --tags, --branches,
903       --stdlayout), git svn clone will create a Git repository with
904       completely linear history, where branches and tags appear as separate
905       directories in the working copy. While this is the easiest way to get a
906       copy of a complete repository, for projects with many branches it will
907       lead to a working copy many times larger than just the trunk. Thus for
908       projects using the standard directory structure (trunk/branches/tags),
909       it is recommended to clone with option --stdlayout. If the project uses
910       a non-standard structure, and/or if branches and tags are not required,
911       it is easiest to only clone one directory (typically trunk), without
912       giving any repository layout options. If the full history with branches
913       and tags is required, the options --trunk / --branches / --tags must be
914       used.
915
916       When using multiple --branches or --tags, git svn does not
917       automatically handle name collisions (for example, if two branches from
918       different paths have the same name, or if a branch and a tag have the
919       same name). In these cases, use init to set up your Git repository
920       then, before your first fetch, edit the .git/config file so that the
921       branches and tags are associated with different name spaces. For
922       example:
923
924           branches = stable/*:refs/remotes/svn/stable/*
925           branches = debug/*:refs/remotes/svn/debug/*
926

BUGS

928       We ignore all SVN properties except svn:executable. Any unhandled
929       properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
930
931       Renamed and copied directories are not detected by Git and hence not
932       tracked when committing to SVN. I do not plan on adding support for
933       this as it’s quite difficult and time-consuming to get working for all
934       the possible corner cases (Git doesn’t do it, either). Committing
935       renamed and copied files is fully supported if they’re similar enough
936       for Git to detect them.
937
938       In SVN, it is possible (though discouraged) to commit changes to a tag
939       (because a tag is just a directory copy, thus technically the same as a
940       branch). When cloning an SVN repository, git svn cannot know if such a
941       commit to a tag will happen in the future. Thus it acts conservatively
942       and imports all SVN tags as branches, prefixing the tag name with
943       tags/.
944

CONFIGURATION

946       git svn stores [svn-remote] configuration information in the repository
947       .git/config file. It is similar the core Git [remote] sections except
948       fetch keys do not accept glob arguments; but they are instead handled
949       by the branches and tags keys. Since some SVN repositories are oddly
950       configured with multiple projects glob expansions such those listed
951       below are allowed:
952
953           [svn-remote "project-a"]
954                   url = http://server.org/svn
955                   fetch = trunk/project-a:refs/remotes/project-a/trunk
956                   branches = branches/*/project-a:refs/remotes/project-a/branches/*
957                   tags = tags/*/project-a:refs/remotes/project-a/tags/*
958
959
960       Keep in mind that the * (asterisk) wildcard of the local ref (right of
961       the :) must be the farthest right path component; however the remote
962       wildcard may be anywhere as long as it’s an independent path component
963       (surrounded by / or EOL). This type of configuration is not
964       automatically created by init and should be manually entered with a
965       text-editor or using git config.
966
967       It is also possible to fetch a subset of branches or tags by using a
968       comma-separated list of names within braces. For example:
969
970           [svn-remote "huge-project"]
971                   url = http://server.org/svn
972                   fetch = trunk/src:refs/remotes/trunk
973                   branches = branches/{red,green}/src:refs/remotes/branches/*
974                   tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
975
976
977       Multiple fetch, branches, and tags keys are supported:
978
979           [svn-remote "messy-repo"]
980                   url = http://server.org/svn
981                   fetch = trunk/project-a:refs/remotes/project-a/trunk
982                   fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
983                   branches = branches/server/*:refs/remotes/project-a/branches/*
984                   branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*
985                   tags = tags/server/*:refs/remotes/project-a/tags/*
986
987
988       Creating a branch in such a configuration requires disambiguating which
989       location to use using the -d or --destination flag:
990
991           $ git svn branch -d branches/server release-2-3-0
992
993
994       Note that git-svn keeps track of the highest revision in which a branch
995       or tag has appeared. If the subset of branches or tags is changed after
996       fetching, then .git/svn/.metadata must be manually edited to remove (or
997       reset) branches-maxRev and/or tags-maxRev as appropriate.
998

SEE ALSO

1000       git-rebase(1)
1001

GIT

1003       Part of the git(1) suite
1004
1005
1006
1007Git 1.8.3.1                       11/19/2018                        GIT-SVN(1)
Impressum