1GIT-SVN(1) Git Manual GIT-SVN(1)
2
3
4
6 git-svn - Bidirectional operation between a Subversion repository and
7 git
8
10 git svn <command> [options] [arguments]
11
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
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 (eg svn+ssh://), you must include the username in
70 the URL, eg 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 is useful if you wish to track
79 multiple projects that share a common repository.
80
81 --ignore-paths=<regex>
82 When passed to init or clone this regular expression will be
83 preserved as a config key. See fetch for a description of
84 --ignore-paths.
85
86 --no-minimize-url
87 When tracking multiple directories (using --stdlayout,
88 --branches, or --tags options), git svn will attempt to connect
89 to the root (or highest allowed level) of the Subversion
90 repository. This default allows better tracking of history if
91 entire projects are moved within a repository, but may cause
92 issues on repositories where read access restrictions are in
93 place. Passing --no-minimize-url will allow git svn to accept
94 URLs as-is without attempting to connect to a higher level
95 directory. This option is off by default when only one
96 URL/branch is tracked (it would do little good).
97
98 fetch
99 Fetch unfetched revisions from the Subversion remote we are
100 tracking. The name of the [svn-remote "..."] section in the
101 .git/config file may be specified as an optional command-line
102 argument.
103
104 --localtime
105 Store Git commit times in the local timezone instead of UTC.
106 This makes git log (even without --date=local) show the same
107 times that svn log would in the local timezone.
108
109 This doesn’t interfere with interoperating with the Subversion
110 repository you cloned from, but if you wish for your local Git
111 repository to be able to interoperate with someone else’s local
112 Git repository, either don’t use this option or you should both
113 use it in the same local timezone.
114
115 --parent
116 Fetch only from the SVN parent of the current HEAD.
117
118 --ignore-paths=<regex>
119 This allows one to specify a Perl regular expression that will
120 cause skipping of all matching paths from checkout from SVN.
121 The --ignore-paths option should match for every fetch
122 (including automatic fetches due to clone, dcommit, rebase,
123 etc) on a given repository.
124
125 config key: svn-remote.<name>.ignore-paths
126
127 If the ignore-paths config key is set and the command line
128 option is also given, both regular expressions will be used.
129
130 Examples:
131
132 Skip "doc*" directory for every fetch
133
134 --ignore-paths="^doc"
135
136
137 Skip "branches" and "tags" of first level directories
138
139 --ignore-paths="^[^/]+/(?:branches|tags)"
140
141
142 --use-log-author
143 When retrieving svn commits into git (as part of fetch, rebase,
144 or dcommit operations), look for the first From: or
145 Signed-off-by: line in the log message and use that as the
146 author string.
147
148 --add-author-from
149 When committing to svn from git (as part of commit or dcommit
150 operations), if the existing log message doesn’t already have a
151 From: or Signed-off-by: line, append a From: line based on the
152 git commit’s author string. If you use this, then
153 --use-log-author will retrieve a valid author string for all
154 commits.
155
156 clone
157 Runs init and fetch. It will automatically create a directory based
158 on the basename of the URL passed to it; or if a second argument is
159 passed; it will create a directory and work within that. It accepts
160 all arguments that the init and fetch commands accept; with the
161 exception of --fetch-all and --parent. After a repository is
162 cloned, the fetch command will be able to update revisions without
163 affecting the working tree; and the rebase command will be able to
164 update the working tree with the latest changes.
165
166 rebase
167 This fetches revisions from the SVN parent of the current HEAD and
168 rebases the current (uncommitted to SVN) work against it.
169
170 This works similarly to svn update or git pull except that it
171 preserves linear history with git rebase instead of git merge for
172 ease of dcommitting with git svn.
173
174 This accepts all options that git svn fetch and git rebase accept.
175 However, --fetch-all only fetches from the current [svn-remote],
176 and not all [svn-remote] definitions.
177
178 Like git rebase; this requires that the working tree be clean and
179 have no uncommitted changes.
180
181 -l, --local
182 Do not fetch remotely; only run git rebase against the last
183 fetched commit from the upstream SVN.
184
185 dcommit
186 Commit each diff from a specified head directly to the SVN
187 repository, and then rebase or reset (depending on whether or not
188 there is a diff between SVN and head). This will create a revision
189 in SVN for each commit in git. It is recommended that you run git
190 svn fetch and rebase (not pull or merge) your commits against the
191 latest changes in the SVN repository. An optional revision or
192 branch argument may be specified, and causes git svn to do all work
193 on that revision/branch instead of HEAD. This is advantageous over
194 set-tree (below) because it produces cleaner, more linear history.
195
196 --no-rebase
197 After committing, do not rebase or reset.
198
199 --commit-url <URL>
200 Commit to this SVN URL (the full path). This is intended to
201 allow existing git svn repositories created with one transport
202 method (e.g. svn:// or http:// for anonymous read) to be
203 reused if a user is later given access to an alternate
204 transport method (e.g. svn+ssh:// or https://) for commit.
205
206 config key: svn-remote.<name>.commiturl
207 config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
208
209 Using this option for any other purpose (don’t ask) is very
210 strongly discouraged.
211
212 branch
213 Create a branch in the SVN repository.
214
215 -m, --message
216 Allows to specify the commit message.
217
218 -t, --tag
219 Create a tag by using the tags_subdir instead of the
220 branches_subdir specified during git svn init.
221
222 -d, --destination
223 If more than one --branches (or --tags) option was given to the
224 init or clone command, you must provide the location of the
225 branch (or tag) you wish to create in the SVN repository. The
226 value of this option must match one of the paths specified by a
227 --branches (or --tags) option. You can see these paths with the
228 commands
229
230 git config --get-all svn-remote.<name>.branches
231 git config --get-all svn-remote.<name>.tags
232
233 where <name> is the name of the SVN repository as specified by
234 the -R option to init (or "svn" by default).
235
236 --username
237 Specify the SVN username to perform the commit as. This option
238 overrides the username configuration property.
239
240 --commit-url
241 Use the specified URL to connect to the destination Subversion
242 repository. This is useful in cases where the source SVN
243 repository is read-only. This option overrides configuration
244 property commiturl.
245
246 git config --get-all svn-remote.<name>.commiturl
247
248 tag
249 Create a tag in the SVN repository. This is a shorthand for branch
250 -t.
251
252 log
253 This should make it easy to look up svn log messages when svn users
254 refer to -r/--revision numbers.
255
256 The following features from ‘svn log’ are supported:
257
258 -r <n>[:<n>], --revision=<n>[:<n>]
259 is supported, non-numeric args are not: HEAD, NEXT, BASE, PREV,
260 etc ...
261
262 -v, --verbose
263 it’s not completely compatible with the --verbose output in svn
264 log, but reasonably close.
265
266 --limit=<n>
267 is NOT the same as --max-count, doesn’t count merged/excluded
268 commits
269
270 --incremental
271 supported
272
273 New features:
274
275 --show-commit
276 shows the git commit sha1, as well
277
278 --oneline
279 our version of --pretty=oneline
280
281
282 Note
283 SVN itself only stores times in UTC and nothing else. The
284 regular svn client converts the UTC time to the local time (or
285 based on the TZ= environment). This command has the same
286 behaviour.
287 Any other arguments are passed directly to git log
288
289 blame
290 Show what revision and author last modified each line of a file.
291 The output of this mode is format-compatible with the output of
292 ‘svn blame’ by default. Like the SVN blame command, local
293 uncommitted changes in the working copy are ignored; the version of
294 the file in the HEAD revision is annotated. Unknown arguments are
295 passed directly to git blame.
296
297 --git-format
298 Produce output in the same format as git blame, but with SVN
299 revision numbers instead of git commit hashes. In this mode,
300 changes that haven’t been committed to SVN (including local
301 working-copy edits) are shown as revision 0.
302
303 find-rev
304 When given an SVN revision number of the form rN, returns the
305 corresponding git commit hash (this can optionally be followed by a
306 tree-ish to specify which branch should be searched). When given a
307 tree-ish, returns the corresponding SVN revision number.
308
309 set-tree
310 You should consider using dcommit instead of this command. Commit
311 specified commit or tree objects to SVN. This relies on your
312 imported fetch data being up-to-date. This makes absolutely no
313 attempts to do patching when committing to SVN, it simply
314 overwrites files with those specified in the tree or commit. All
315 merging is assumed to have taken place independently of git svn
316 functions.
317
318 create-ignore
319 Recursively finds the svn:ignore property on directories and
320 creates matching .gitignore files. The resulting files are staged
321 to be committed, but are not committed. Use -r/--revision to refer
322 to a specific revision.
323
324 show-ignore
325 Recursively finds and lists the svn:ignore property on directories.
326 The output is suitable for appending to the $GIT_DIR/info/exclude
327 file.
328
329 mkdirs
330 Attempts to recreate empty directories that core git cannot track
331 based on information in $GIT_DIR/svn/<refname>/unhandled.log files.
332 Empty directories are automatically recreated when using "git svn
333 clone" and "git svn rebase", so "mkdirs" is intended for use after
334 commands like "git checkout" or "git reset".
335
336 commit-diff
337 Commits the diff of two tree-ish arguments from the command-line.
338 This command does not rely on being inside an git svn init-ed
339 repository. This command takes three arguments, (a) the original
340 tree to diff against, (b) the new tree result, (c) the URL of the
341 target Subversion repository. The final argument (URL) may be
342 omitted if you are working from a git svn-aware repository (that
343 has been init-ed with git svn). The -r<revision> option is required
344 for this.
345
346 info
347 Shows information about a file or directory similar to what ‘svn
348 info’ provides. Does not currently support a -r/--revision
349 argument. Use the --url option to output only the value of the URL:
350 field.
351
352 proplist
353 Lists the properties stored in the Subversion repository about a
354 given file or directory. Use -r/--revision to refer to a specific
355 Subversion revision.
356
357 propget
358 Gets the Subversion property given as the first argument, for a
359 file. A specific revision can be specified with -r/--revision.
360
361 show-externals
362 Shows the Subversion externals. Use -r/--revision to specify a
363 specific revision.
364
365 gc
366 Compress $GIT_DIR/svn/<refname>/unhandled.log files in .git/svn and
367 remove $GIT_DIR/svn/<refname>index files in .git/svn.
368
369 reset
370 Undoes the effects of fetch back to the specified revision. This
371 allows you to re-fetch an SVN revision. Normally the contents of an
372 SVN revision should never change and reset should not be necessary.
373 However, if SVN permissions change, or if you alter your
374 --ignore-paths option, a fetch may fail with "not found in commit"
375 (file not previously visible) or "checksum mismatch" (missed a
376 modification). If the problem file cannot be ignored forever (with
377 --ignore-paths) the only way to repair the repo is to use reset.
378
379 Only the rev_map and refs/remotes/git-svn are changed. Follow reset
380 with a fetch and then git reset or git rebase to move local
381 branches onto the new tree.
382
383 -r <n>, --revision=<n>
384 Specify the most recent revision to keep. All later revisions
385 are discarded.
386
387 -p, --parent
388 Discard the specified revision as well, keeping the nearest
389 parent instead.
390
391 Example:
392 Assume you have local changes in "master", but you need to
393 refetch "r2".
394
395 r1---r2---r3 remotes/git-svn
396 \
397 A---B master
398
399 Fix the ignore-paths or SVN permissions problem that caused
400 "r2" to be incomplete in the first place. Then:
401
402 git svn reset -r2 -p
403 git svn fetch
404
405
406
407 r1---r2'--r3' remotes/git-svn
408 \
409 r2---r3---A---B master
410
411 Then fixup "master" with git rebase. Do NOT use git merge or
412 your history will not be compatible with a future dcommit!
413
414 git rebase --onto remotes/git-svn A^ master
415
416
417
418 r1---r2'--r3' remotes/git-svn
419 \
420 A'--B' master
421
422
424 --shared[=(false|true|umask|group|all|world|everybody)],
425 --template=<template_directory>
426 Only used with the init command. These are passed directly to git
427 init.
428
429 -r <arg>, --revision <arg>
430 Used with the fetch command.
431
432 This allows revision ranges for partial/cauterized history to be
433 supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
434 $NUMBER:HEAD, and BASE:$NUMBER are all supported.
435
436 This can allow you to make partial mirrors when running fetch; but
437 is generally not recommended because history will be skipped and
438 lost.
439
440 -, --stdin
441 Only used with the set-tree command.
442
443 Read a list of commits from stdin and commit them in reverse order.
444 Only the leading sha1 is read from each line, so git rev-list
445 --pretty=oneline output can be used.
446
447 --rmdir
448 Only used with the dcommit, set-tree and commit-diff commands.
449
450 Remove directories from the SVN tree if there are no files left
451 behind. SVN can version empty directories, and they are not removed
452 by default if there are no files left in them. git cannot version
453 empty directories. Enabling this flag will make the commit to SVN
454 act like git.
455
456 config key: svn.rmdir
457
458
459 -e, --edit
460 Only used with the dcommit, set-tree and commit-diff commands.
461
462 Edit the commit message before committing to SVN. This is off by
463 default for objects that are commits, and forced on when committing
464 tree objects.
465
466 config key: svn.edit
467
468
469 -l<num>, --find-copies-harder
470 Only used with the dcommit, set-tree and commit-diff commands.
471
472 They are both passed directly to git diff-tree; see git-diff-
473 tree(1) for more information.
474
475 config key: svn.l
476 config key: svn.findcopiesharder
477
478
479 -A<filename>, --authors-file=<filename>
480 Syntax is compatible with the file used by git cvsimport:
481
482 loginname = Joe User <user@example.com>
483
484 If this option is specified and git svn encounters an SVN committer
485 name that does not exist in the authors-file, git svn will abort
486 operation. The user will then have to add the appropriate entry.
487 Re-running the previous git svn command after the authors-file is
488 modified should continue operation.
489
490 config key: svn.authorsfile
491
492
493 --authors-prog=<filename>
494 If this option is specified, for each SVN committer name that does
495 not exist in the authors file, the given file is executed with the
496 committer name as the first argument. The program is expected to
497 return a single line of the form "Name <email>", which will be
498 treated as if included in the authors file.
499
500 -q, --quiet
501 Make git svn less verbose. Specify a second time to make it even
502 less verbose.
503
504 --repack[=<n>], --repack-flags=<flags>
505 These should help keep disk usage sane for large fetches with many
506 revisions.
507
508 --repack takes an optional argument for the number of revisions to
509 fetch before repacking. This defaults to repacking every 1000
510 commits fetched if no argument is specified.
511
512 --repack-flags are passed directly to git repack.
513
514 config key: svn.repack
515 config key: svn.repackflags
516
517
518 -m, --merge, -s<strategy>, --strategy=<strategy>
519 These are only used with the dcommit and rebase commands.
520
521 Passed directly to git rebase when using dcommit if a git reset
522 cannot be used (see dcommit).
523
524 -n, --dry-run
525 This can be used with the dcommit, rebase, branch and tag commands.
526
527 For dcommit, print out the series of git arguments that would show
528 which diffs would be committed to SVN.
529
530 For rebase, display the local branch associated with the upstream
531 svn repository associated with the current branch and the URL of
532 svn repository that will be fetched from.
533
534 For branch and tag, display the urls that will be used for copying
535 when creating the branch or tag.
536
538 -i<GIT_SVN_ID>, --id <GIT_SVN_ID>
539 This sets GIT_SVN_ID (instead of using the environment). This
540 allows the user to override the default refname to fetch from when
541 tracking a single URL. The log and dcommit commands no longer
542 require this switch as an argument.
543
544 -R<remote name>, --svn-remote <remote name>
545 Specify the [svn-remote "<remote name>"] section to use, this
546 allows SVN multiple repositories to be tracked. Default: "svn"
547
548 --follow-parent
549 This is especially helpful when we’re tracking a directory that has
550 been moved around within the repository, or if we started tracking
551 a branch and never tracked the trunk it was descended from. This
552 feature is enabled by default, use --no-follow-parent to disable
553 it.
554
555 config key: svn.followparent
556
557
559 svn.noMetadata, svn-remote.<name>.noMetadata
560 This gets rid of the git-svn-id: lines at the end of every commit.
561
562 This option can only be used for one-shot imports as git svn will
563 not be able to fetch again without metadata. Additionally, if you
564 lose your .git/svn/*/.rev_map. files, git svn will not be able to
565 rebuild them.
566
567 The git svn log command will not work on repositories using this,
568 either. Using this conflicts with the useSvmProps option for
569 (hopefully) obvious reasons.
570
571 This option is NOT recommended as it makes it difficult to track
572 down old references to SVN revision numbers in existing
573 documentation, bug reports and archives. If you plan to eventually
574 migrate from SVN to git and are certain about dropping SVN history,
575 consider git-filter-branch(1) instead. filter-branch also allows
576 reformatting of metadata for ease-of-reading and rewriting
577 authorship info for non-"svn.authorsFile" users.
578
579 svn.useSvmProps, svn-remote.<name>.useSvmProps
580 This allows git svn to re-map repository URLs and UUIDs from
581 mirrors created using SVN::Mirror (or svk) for metadata.
582
583 If an SVN revision has a property, "svm:headrev", it is likely that
584 the revision was created by SVN::Mirror (also used by SVK). The
585 property contains a repository UUID and a revision. We want to make
586 it look like we are mirroring the original URL, so introduce a
587 helper function that returns the original identity URL and UUID,
588 and use it when generating metadata in commit messages.
589
590 svn.useSvnsyncProps, svn-remote.<name>.useSvnsyncprops
591 Similar to the useSvmProps option; this is for users of the
592 svnsync(1) command distributed with SVN 1.4.x and later.
593
594 svn-remote.<name>.rewriteRoot
595 This allows users to create repositories from alternate URLs. For
596 example, an administrator could run git svn on the server locally
597 (accessing via file://) but wish to distribute the repository with
598 a public http:// or svn:// URL in the metadata so users of it will
599 see the public URL.
600
601 svn-remote.<name>.rewriteUUID
602 Similar to the useSvmProps option; this is for users who need to
603 remap the UUID manually. This may be useful in situations where the
604 original UUID is not available via either useSvmProps or
605 useSvnsyncProps.
606
607 svn.brokenSymlinkWorkaround
608 This disables potentially expensive checks to workaround broken
609 symlinks checked into SVN by broken clients. Set this option to
610 "false" if you track a SVN repository with many empty blobs that
611 are not symlinks. This option may be changed while git svn is
612 running and take effect on the next revision fetched. If unset, git
613 svn assumes this option to be "true".
614
615 svn.pathnameencoding
616 This instructs git svn to recode pathnames to a given encoding. It
617 can be used by windows users and by those who work in non-utf8
618 locales to avoid corrupted file names with non-ASCII characters.
619 Valid encodings are the ones supported by Perl’s Encode module.
620
621 Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and
622 useSvmProps options all affect the metadata generated and used by git
623 svn; they must be set in the configuration file before any history is
624 imported and these settings should never be changed once they are set.
625
626 Additionally, only one of these options can be used per svn-remote
627 section because they affect the git-svn-id: metadata line, except for
628 rewriteRoot and rewriteUUID which can be used together.
629
631 Tracking and contributing to the trunk of a Subversion-managed project:
632
633 # Clone a repo (like git clone):
634 git svn clone http://svn.example.com/project/trunk
635 # Enter the newly cloned directory:
636 cd trunk
637 # You should be on master branch, double-check with 'git branch'
638 git branch
639 # Do some work and commit locally to git:
640 git commit ...
641 # Something is committed to SVN, rebase your local changes against the
642 # latest changes in SVN:
643 git svn rebase
644 # Now commit your changes (that were committed previously using git) to SVN,
645 # as well as automatically updating your working HEAD:
646 git svn dcommit
647 # Append svn:ignore settings to the default git exclude file:
648 git svn show-ignore >> .git/info/exclude
649
650
651 Tracking and contributing to an entire Subversion-managed project
652 (complete with a trunk, tags and branches):
653
654 # Clone a repo (like git clone):
655 git svn clone http://svn.example.com/project -T trunk -b branches -t tags
656 # View all branches and tags you have cloned:
657 git branch -r
658 # Create a new branch in SVN
659 git svn branch waldo
660 # Reset your master to trunk (or any other branch, replacing 'trunk'
661 # with the appropriate name):
662 git reset --hard remotes/trunk
663 # You may only dcommit to one branch/tag/trunk at a time. The usage
664 # of dcommit/rebase/show-ignore should be the same as above.
665
666
667 The initial git svn clone can be quite time-consuming (especially for
668 large Subversion repositories). If multiple people (or one person with
669 multiple machines) want to use git svn to interact with the same
670 Subversion repository, you can do the initial git svn clone to a
671 repository on a server and have each person clone that repository with
672 git clone:
673
674 # Do the initial import on a server
675 ssh server "cd /pub && git svn clone http://svn.example.com/project
676 # Clone locally - make sure the refs/remotes/ space matches the server
677 mkdir project
678 cd project
679 git init
680 git remote add origin server:/pub/project
681 git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
682 git fetch
683 # Prevent fetch/pull from remote git server in the future,
684 # we only want to use git svn for future updates
685 git config --remove-section remote.origin
686 # Create a local branch from one of the branches just fetched
687 git checkout -b master FETCH_HEAD
688 # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
689 git svn init http://svn.example.com/project
690 # Pull the latest changes from Subversion
691 git svn rebase
692
693
695 Originally, git svn recommended that the remotes/git-svn branch be
696 pulled or merged from. This is because the author favored git svn
697 set-tree B to commit a single head rather than the git svn set-tree
698 A..B notation to commit multiple commits.
699
700 If you use git svn set-tree A..B to commit several diffs and you do not
701 have the latest remotes/git-svn merged into my-branch, you should use
702 git svn rebase to update your work branch instead of git pull or git
703 merge. pull/merge can cause non-linear history to be flattened when
704 committing into SVN, which can lead to merge commits reversing previous
705 commits in SVN.
706
708 Merge tracking in Subversion is lacking and doing branched development
709 with Subversion can be cumbersome as a result. While git svn can track
710 copy history (including branches and tags) for repositories adopting a
711 standard layout, it cannot yet represent merge history that happened
712 inside git back upstream to SVN users. Therefore it is advised that
713 users keep history as linear as possible inside git to ease
714 compatibility with SVN (see the CAVEATS section below).
715
717 For the sake of simplicity and interoperating with a less-capable
718 system (SVN), it is recommended that all git svn users clone, fetch and
719 dcommit directly from the SVN server, and avoid all git
720 clone/pull/merge/push operations between git repositories and branches.
721 The recommended method of exchanging code between git branches and
722 users is git format-patch and git am, or just 'dcommit’ing to the SVN
723 repository.
724
725 Running git merge or git pull is NOT recommended on a branch you plan
726 to dcommit from. Subversion does not represent merges in any reasonable
727 or useful fashion; so users using Subversion cannot see any merges
728 you’ve made. Furthermore, if you merge or pull from a git branch that
729 is a mirror of an SVN branch, dcommit may commit to the wrong branch.
730
731 If you do merge, note the following rule: git svn dcommit will attempt
732 to commit on top of the SVN commit named in
733
734 git log --grep=^git-svn-id: --first-parent -1
735
736
737 You must therefore ensure that the most recent commit of the branch you
738 want to dcommit to is the first parent of the merge. Chaos will ensue
739 otherwise, especially if the first parent is an older commit on the
740 same SVN branch.
741
742 git clone does not clone branches under the refs/remotes/ hierarchy or
743 any git svn metadata, or config. So repositories created and managed
744 with using git svn should use rsync for cloning, if cloning is to be
745 done at all.
746
747 Since dcommit uses rebase internally, any git branches you git push to
748 before dcommit on will require forcing an overwrite of the existing ref
749 on the remote repository. This is generally considered bad practice,
750 see the git-push(1) documentation for details.
751
752 Do not use the --amend option of git-commit(1) on a change you’ve
753 already dcommitted. It is considered bad practice to --amend commits
754 you’ve already pushed to a remote repository for other users, and
755 dcommit with SVN is analogous to that.
756
757 When using multiple --branches or --tags, git svn does not
758 automatically handle name collisions (for example, if two branches from
759 different paths have the same name, or if a branch and a tag have the
760 same name). In these cases, use init to set up your git repository
761 then, before your first fetch, edit the .git/config file so that the
762 branches and tags are associated with different name spaces. For
763 example:
764
765 branches = stable/*:refs/remotes/svn/stable/*
766 branches = debug/*:refs/remotes/svn/debug/*
767
769 We ignore all SVN properties except svn:executable. Any unhandled
770 properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
771
772 Renamed and copied directories are not detected by git and hence not
773 tracked when committing to SVN. I do not plan on adding support for
774 this as it’s quite difficult and time-consuming to get working for all
775 the possible corner cases (git doesn’t do it, either). Committing
776 renamed and copied files are fully supported if they’re similar enough
777 for git to detect them.
778
780 git svn stores [svn-remote] configuration information in the repository
781 .git/config file. It is similar the core git [remote] sections except
782 fetch keys do not accept glob arguments; but they are instead handled
783 by the branches and tags keys. Since some SVN repositories are oddly
784 configured with multiple projects glob expansions such those listed
785 below are allowed:
786
787 [svn-remote "project-a"]
788 url = http://server.org/svn
789 fetch = trunk/project-a:refs/remotes/project-a/trunk
790 branches = branches/*/project-a:refs/remotes/project-a/branches/*
791 tags = tags/*/project-a:refs/remotes/project-a/tags/*
792
793
794 Keep in mind that the * (asterisk) wildcard of the local ref (right of
795 the :) must be the farthest right path component; however the remote
796 wildcard may be anywhere as long as it’s an independent path component
797 (surrounded by / or EOL). This type of configuration is not
798 automatically created by init and should be manually entered with a
799 text-editor or using git config.
800
801 It is also possible to fetch a subset of branches or tags by using a
802 comma-separated list of names within braces. For example:
803
804 [svn-remote "huge-project"]
805 url = http://server.org/svn
806 fetch = trunk/src:refs/remotes/trunk
807 branches = branches/{red,green}/src:refs/remotes/branches/*
808 tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
809
810
811 Note that git-svn keeps track of the highest revision in which a branch
812 or tag has appeared. If the subset of branches or tags is changed after
813 fetching, then .git/svn/.metadata must be manually edited to remove (or
814 reset) branches-maxRev and/or tags-maxRev as appropriate.
815
817 git-rebase(1)
818
820 Written by Eric Wong <normalperson@yhbt.net[1]>.
821
823 Written by Eric Wong <normalperson@yhbt.net[1]>.
824
826 1. normalperson@yhbt.net
827 mailto:normalperson@yhbt.net
828
829
830
831Git 1.7.4.4 04/11/2011 GIT-SVN(1)