1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <article lang="en" id="git-svn(1)">
\r
6 <title>git-svn(1)</title>
\r
8 <primary>git-svn(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-svn - Bidirectional operation between a Subversion repository and git</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
18 <literallayout><emphasis>git svn</emphasis> <command> [options] [arguments]</literallayout>
\r
21 <simplesect id="_description">
\r
22 <title>DESCRIPTION</title>
\r
23 <simpara><emphasis>git svn</emphasis> is a simple conduit for changesets between Subversion and git.
\r
24 It provides a bidirectional flow of changes between a Subversion and a git
\r
25 repository.</simpara>
\r
26 <simpara><emphasis>git svn</emphasis> can track a standard Subversion repository,
\r
27 following the common "trunk/branches/tags" layout, with the --stdlayout option.
\r
28 It can also follow branches and tags in any layout with the -T/-t/-b options
\r
29 (see options to <emphasis>init</emphasis> below, and also the <emphasis>clone</emphasis> command).</simpara>
\r
30 <simpara>Once tracking a Subversion repository (with any of the above methods), the git
\r
31 repository can be updated from Subversion by the <emphasis>fetch</emphasis> command and
\r
32 Subversion updated from git by the <emphasis>dcommit</emphasis> command.</simpara>
\r
34 <simplesect id="_commands">
\r
35 <title>COMMANDS</title>
\r
39 <emphasis>init</emphasis>
\r
43 Initializes an empty git repository with additional
\r
44 metadata directories for <emphasis>git svn</emphasis>. The Subversion URL
\r
45 may be specified as a command-line argument, or as full
\r
46 URL arguments to -T/-t/-b. Optionally, the target
\r
47 directory to operate on can be specified as a second
\r
48 argument. Normally this command initializes the current
\r
54 -T<trunk_subdir>
\r
57 --trunk=<trunk_subdir>
\r
60 -t<tags_subdir>
\r
63 --tags=<tags_subdir>
\r
66 -b<branches_subdir>
\r
69 --branches=<branches_subdir>
\r
79 These are optional command-line options for init. Each of
\r
80 these flags can point to a relative repository path
\r
81 (--tags=project/tags) or a full url
\r
82 (--tags=https://foo.org/project/tags).
\r
83 You can specify more than one --tags and/or --branches options, in case
\r
84 your Subversion repository places tags or branches under multiple paths.
\r
85 The option --stdlayout is
\r
86 a shorthand way of setting trunk,tags,branches as the relative paths,
\r
87 which is the Subversion default. If any of the other options are given
\r
88 as well, they take precedence.
\r
98 Set the <emphasis>noMetadata</emphasis> option in the [svn-remote] config.
\r
99 This option is not recommended, please read the <emphasis>svn.noMetadata</emphasis>
\r
100 section of this manpage before using this option.
\r
110 Set the <emphasis>useSvmProps</emphasis> option in the [svn-remote] config.
\r
116 --use-svnsync-props
\r
120 Set the <emphasis>useSvnsyncProps</emphasis> option in the [svn-remote] config.
\r
126 --rewrite-root=<URL>
\r
130 Set the <emphasis>rewriteRoot</emphasis> option in the [svn-remote] config.
\r
136 --rewrite-uuid=<UUID>
\r
140 Set the <emphasis>rewriteUUID</emphasis> option in the [svn-remote] config.
\r
146 --username=<user>
\r
150 For transports that SVN handles authentication for (http,
\r
151 https, and plain svn), specify the username. For other
\r
152 transports (eg svn+ssh://), you must include the username in
\r
153 the URL, eg svn+ssh://foo@svn.bar.com/project
\r
159 --prefix=<prefix>
\r
163 This allows one to specify a prefix which is prepended
\r
164 to the names of remotes if trunk/branches/tags are
\r
165 specified. The prefix does not automatically include a
\r
166 trailing slash, so be sure you include one in the
\r
167 argument if that is what you want. If --branches/-b is
\r
168 specified, the prefix must include a trailing slash.
\r
169 Setting a prefix is useful if you wish to track multiple
\r
170 projects that share a common repository.
\r
176 --ignore-paths=<regex>
\r
180 When passed to <emphasis>init</emphasis> or <emphasis>clone</emphasis> this regular expression will
\r
181 be preserved as a config key. See <emphasis>fetch</emphasis> for a description
\r
182 of <emphasis>--ignore-paths</emphasis>.
\r
192 When tracking multiple directories (using --stdlayout,
\r
193 --branches, or --tags options), git svn will attempt to connect
\r
194 to the root (or highest allowed level) of the Subversion
\r
195 repository. This default allows better tracking of history if
\r
196 entire projects are moved within a repository, but may cause
\r
197 issues on repositories where read access restrictions are in
\r
198 place. Passing <emphasis>--no-minimize-url</emphasis> will allow git svn to
\r
199 accept URLs as-is without attempting to connect to a higher
\r
200 level directory. This option is off by default when only
\r
201 one URL/branch is tracked (it would do little good).
\r
210 <emphasis>fetch</emphasis>
\r
214 Fetch unfetched revisions from the Subversion remote we are
\r
215 tracking. The name of the [svn-remote "…"] section in the
\r
216 .git/config file may be specified as an optional command-line
\r
226 Store Git commit times in the local timezone instead of UTC. This
\r
227 makes <emphasis>git log</emphasis> (even without --date=local) show the same times
\r
228 that <emphasis>svn log</emphasis> would in the local timezone.
\r
230 <simpara>This doesn't interfere with interoperating with the Subversion
\r
231 repository you cloned from, but if you wish for your local Git
\r
232 repository to be able to interoperate with someone else's local Git
\r
233 repository, either don't use this option or you should both use it in
\r
234 the same local timezone.</simpara>
\r
243 Fetch only from the SVN parent of the current HEAD.
\r
249 --ignore-paths=<regex>
\r
253 This allows one to specify a Perl regular expression that will
\r
254 cause skipping of all matching paths from checkout from SVN.
\r
255 The <emphasis>--ignore-paths</emphasis> option should match for every <emphasis>fetch</emphasis>
\r
256 (including automatic fetches due to <emphasis>clone</emphasis>, <emphasis>dcommit</emphasis>,
\r
257 <emphasis>rebase</emphasis>, etc) on a given repository.
\r
260 <literallayout>config key: svn-remote.<name>.ignore-paths</literallayout>
\r
262 <simpara>If the ignore-paths config key is set and the command line option is
\r
263 also given, both regular expressions will be used.</simpara>
\r
264 <simpara>Examples:</simpara>
\r
268 Skip "doc*" directory for every fetch
\r
271 <screen>--ignore-paths="^doc"</screen>
\r
276 Skip "branches" and "tags" of first level directories
\r
279 <screen>--ignore-paths="^[^/]+/(?:branches|tags)"</screen>
\r
290 <emphasis>clone</emphasis>
\r
294 Runs <emphasis>init</emphasis> and <emphasis>fetch</emphasis>. It will automatically create a
\r
295 directory based on the basename of the URL passed to it;
\r
296 or if a second argument is passed; it will create a directory
\r
297 and work within that. It accepts all arguments that the
\r
298 <emphasis>init</emphasis> and <emphasis>fetch</emphasis> commands accept; with the exception of
\r
299 <emphasis>--fetch-all</emphasis> and <emphasis>--parent</emphasis>. After a repository is cloned,
\r
300 the <emphasis>fetch</emphasis> command will be able to update revisions without
\r
301 affecting the working tree; and the <emphasis>rebase</emphasis> command will be
\r
302 able to update the working tree with the latest changes.
\r
307 --preserve-empty-dirs
\r
311 Create a placeholder file in the local Git repository for each
\r
312 empty directory fetched from Subversion. This includes directories
\r
313 that become empty by removing all entries in the Subversion
\r
314 repository (but not the directory itself). The placeholder files
\r
315 are also tracked and removed when no longer necessary.
\r
321 --placeholder-filename=<filename>
\r
325 Set the name of placeholder files created by --preserve-empty-dirs.
\r
326 Default: ".gitignore"
\r
335 <emphasis>rebase</emphasis>
\r
339 This fetches revisions from the SVN parent of the current HEAD
\r
340 and rebases the current (uncommitted to SVN) work against it.
\r
342 <simpara>This works similarly to <emphasis>svn update</emphasis> or <emphasis>git pull</emphasis> except that
\r
343 it preserves linear history with <emphasis>git rebase</emphasis> instead of
\r
344 <emphasis>git merge</emphasis> for ease of dcommitting with <emphasis>git svn</emphasis>.</simpara>
\r
345 <simpara>This accepts all options that <emphasis>git svn fetch</emphasis> and <emphasis>git rebase</emphasis>
\r
346 accept. However, <emphasis>--fetch-all</emphasis> only fetches from the current
\r
347 [svn-remote], and not all [svn-remote] definitions.</simpara>
\r
348 <simpara>Like <emphasis>git rebase</emphasis>; this requires that the working tree be clean
\r
349 and have no uncommitted changes.</simpara>
\r
360 Do not fetch remotely; only run <emphasis>git rebase</emphasis> against the
\r
361 last fetched commit from the upstream SVN.
\r
370 <emphasis>dcommit</emphasis>
\r
374 Commit each diff from a specified head directly to the SVN
\r
375 repository, and then rebase or reset (depending on whether or
\r
376 not there is a diff between SVN and head). This will create
\r
377 a revision in SVN for each commit in git.
\r
378 It is recommended that you run <emphasis>git svn</emphasis> fetch and rebase (not
\r
379 pull or merge) your commits against the latest changes in the
\r
381 An optional revision or branch argument may be specified, and
\r
382 causes <emphasis>git svn</emphasis> to do all work on that revision/branch
\r
384 This is advantageous over <emphasis>set-tree</emphasis> (below) because it produces
\r
385 cleaner, more linear history.
\r
394 After committing, do not rebase or reset.
\r
400 --commit-url <URL>
\r
404 Commit to this SVN URL (the full path). This is intended to
\r
405 allow existing <emphasis>git svn</emphasis> repositories created with one transport
\r
406 method (e.g. <emphasis>svn://</emphasis> or <emphasis>http://</emphasis> for anonymous read) to be
\r
407 reused if a user is later given access to an alternate transport
\r
408 method (e.g. <emphasis>svn+ssh://</emphasis> or <emphasis>https://</emphasis>) for commit.
\r
411 <literallayout>config key: svn-remote.<name>.commiturl
\r
412 config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)</literallayout>
\r
414 <simpara>Using this option for any other purpose (don't ask) is very strongly
\r
415 discouraged.</simpara>
\r
420 --mergeinfo=<mergeinfo>
\r
424 Add the given merge information during the dcommit
\r
425 (e.g. <emphasis>--mergeinfo="/branches/foo:1-10"</emphasis>). All svn server versions can
\r
426 store this information (as a property), and svn clients starting from
\r
427 version 1.5 can make use of it. To specify merge information from multiple
\r
428 branches, use a single space character between the branches
\r
429 (<emphasis>--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"</emphasis>)
\r
432 <literallayout>config key: svn.pushmergeinfo</literallayout>
\r
434 <simpara>This option will cause git-svn to attempt to automatically populate the
\r
435 svn:mergeinfo property in the SVN repository when possible. Currently, this can
\r
436 only be done when dcommitting non-fast-forward merges where all parents but the
\r
437 first have already been pushed into SVN.</simpara>
\r
446 Ask the user to confirm that a patch set should actually be sent to SVN.
\r
447 For each patch, one may answer "yes" (accept this patch), "no" (discard this
\r
448 patch), "all" (accept all patches), or "quit".
\r
450 <emphasis>git svn dcommit</emphasis> returns immediately if answer if "no" or "quit", without
\r
451 commiting anything to SVN.
\r
460 <emphasis>branch</emphasis>
\r
464 Create a branch in the SVN repository.
\r
476 Allows to specify the commit message.
\r
489 Create a tag by using the tags_subdir instead of the branches_subdir
\r
490 specified during git svn init.
\r
503 If more than one --branches (or --tags) option was given to the <emphasis>init</emphasis>
\r
504 or <emphasis>clone</emphasis> command, you must provide the location of the branch (or
\r
505 tag) you wish to create in the SVN repository. The value of this
\r
506 option must match one of the paths specified by a --branches (or
\r
507 --tags) option. You can see these paths with the commands
\r
509 <literallayout class="monospaced">git config --get-all svn-remote.<name>.branches
\r
510 git config --get-all svn-remote.<name>.tags</literallayout>
\r
511 <simpara>where <name> is the name of the SVN repository as specified by the -R option to
\r
512 <emphasis>init</emphasis> (or "svn" by default).</simpara>
\r
521 Specify the SVN username to perform the commit as. This option overrides
\r
522 the <emphasis>username</emphasis> configuration property.
\r
532 Use the specified URL to connect to the destination Subversion
\r
533 repository. This is useful in cases where the source SVN
\r
534 repository is read-only. This option overrides configuration
\r
535 property <emphasis>commiturl</emphasis>.
\r
537 <literallayout class="monospaced">git config --get-all svn-remote.<name>.commiturl</literallayout>
\r
545 <emphasis>tag</emphasis>
\r
549 Create a tag in the SVN repository. This is a shorthand for
\r
550 <emphasis>branch -t</emphasis>.
\r
556 <emphasis>log</emphasis>
\r
560 This should make it easy to look up svn log messages when svn
\r
561 users refer to -r/--revision numbers.
\r
563 <simpara>The following features from svn log are supported:</simpara>
\r
567 -r <n>[:<n>]
\r
570 --revision=<n>[:<n>]
\r
574 is supported, non-numeric args are not:
\r
575 HEAD, NEXT, BASE, PREV, etc …
\r
588 it's not completely compatible with the --verbose
\r
589 output in svn log, but reasonably close.
\r
599 is NOT the same as --max-count, doesn't count
\r
600 merged/excluded commits
\r
615 <simpara>New features:</simpara>
\r
623 shows the git commit sha1, as well
\r
633 our version of --pretty=oneline
\r
638 <note><simpara>SVN itself only stores times in UTC and nothing else. The regular svn
\r
639 client converts the UTC time to the local time (or based on the TZ=
\r
640 environment). This command has the same behaviour.</simpara></note>
\r
641 <simpara>Any other arguments are passed directly to <emphasis>git log</emphasis></simpara>
\r
646 <emphasis>blame</emphasis>
\r
650 Show what revision and author last modified each line of a file. The
\r
651 output of this mode is format-compatible with the output of
\r
652 svn blame by default. Like the SVN blame command,
\r
653 local uncommitted changes in the working tree are ignored;
\r
654 the version of the file in the HEAD revision is annotated. Unknown
\r
655 arguments are passed directly to <emphasis>git blame</emphasis>.
\r
664 Produce output in the same format as <emphasis>git blame</emphasis>, but with
\r
665 SVN revision numbers instead of git commit hashes. In this mode,
\r
666 changes that haven't been committed to SVN (including local
\r
667 working-copy edits) are shown as revision 0.
\r
676 <emphasis>find-rev</emphasis>
\r
680 When given an SVN revision number of the form <emphasis>rN</emphasis>, returns the
\r
681 corresponding git commit hash (this can optionally be followed by a
\r
682 tree-ish to specify which branch should be searched). When given a
\r
683 tree-ish, returns the corresponding SVN revision number.
\r
689 <emphasis>set-tree</emphasis>
\r
693 You should consider using <emphasis>dcommit</emphasis> instead of this command.
\r
694 Commit specified commit or tree objects to SVN. This relies on
\r
695 your imported fetch data being up-to-date. This makes
\r
696 absolutely no attempts to do patching when committing to SVN, it
\r
697 simply overwrites files with those specified in the tree or
\r
698 commit. All merging is assumed to have taken place
\r
699 independently of <emphasis>git svn</emphasis> functions.
\r
705 <emphasis>create-ignore</emphasis>
\r
709 Recursively finds the svn:ignore property on directories and
\r
710 creates matching .gitignore files. The resulting files are staged to
\r
711 be committed, but are not committed. Use -r/--revision to refer to a
\r
718 <emphasis>show-ignore</emphasis>
\r
722 Recursively finds and lists the svn:ignore property on
\r
723 directories. The output is suitable for appending to
\r
724 the $GIT_DIR/info/exclude file.
\r
730 <emphasis>mkdirs</emphasis>
\r
734 Attempts to recreate empty directories that core git cannot track
\r
735 based on information in $GIT_DIR/svn/<refname>/unhandled.log files.
\r
736 Empty directories are automatically recreated when using
\r
737 "git svn clone" and "git svn rebase", so "mkdirs" is intended
\r
738 for use after commands like "git checkout" or "git reset".
\r
739 (See the svn-remote.<name>.automkdirs config file option for
\r
746 <emphasis>commit-diff</emphasis>
\r
750 Commits the diff of two tree-ish arguments from the
\r
751 command-line. This command does not rely on being inside an <emphasis>git svn
\r
752 init</emphasis>-ed repository. This command takes three arguments, (a) the
\r
753 original tree to diff against, (b) the new tree result, (c) the
\r
754 URL of the target Subversion repository. The final argument
\r
755 (URL) may be omitted if you are working from a <emphasis>git svn</emphasis>-aware
\r
756 repository (that has been <emphasis>init</emphasis>-ed with <emphasis>git svn</emphasis>).
\r
757 The -r<revision> option is required for this.
\r
763 <emphasis>info</emphasis>
\r
767 Shows information about a file or directory similar to what
\r
768 svn info provides. Does not currently support a -r/--revision
\r
769 argument. Use the --url option to output only the value of the
\r
770 <emphasis>URL:</emphasis> field.
\r
776 <emphasis>proplist</emphasis>
\r
780 Lists the properties stored in the Subversion repository about a
\r
781 given file or directory. Use -r/--revision to refer to a specific
\r
782 Subversion revision.
\r
788 <emphasis>propget</emphasis>
\r
792 Gets the Subversion property given as the first argument, for a
\r
793 file. A specific revision can be specified with -r/--revision.
\r
799 <emphasis>show-externals</emphasis>
\r
803 Shows the Subversion externals. Use -r/--revision to specify a
\r
810 <emphasis>gc</emphasis>
\r
814 Compress $GIT_DIR/svn/<refname>/unhandled.log files in .git/svn
\r
815 and remove $GIT_DIR/svn/<refname>index files in .git/svn.
\r
821 <emphasis>reset</emphasis>
\r
825 Undoes the effects of <emphasis>fetch</emphasis> back to the specified revision.
\r
826 This allows you to re-<emphasis>fetch</emphasis> an SVN revision. Normally the
\r
827 contents of an SVN revision should never change and <emphasis>reset</emphasis>
\r
828 should not be necessary. However, if SVN permissions change,
\r
829 or if you alter your --ignore-paths option, a <emphasis>fetch</emphasis> may fail
\r
830 with "not found in commit" (file not previously visible) or
\r
831 "checksum mismatch" (missed a modification). If the problem
\r
832 file cannot be ignored forever (with --ignore-paths) the only
\r
833 way to repair the repo is to use <emphasis>reset</emphasis>.
\r
835 <simpara>Only the rev_map and refs/remotes/git-svn are changed. Follow <emphasis>reset</emphasis>
\r
836 with a <emphasis>fetch</emphasis> and then <emphasis>git reset</emphasis> or <emphasis>git rebase</emphasis> to move local
\r
837 branches onto the new tree.</simpara>
\r
844 --revision=<n>
\r
848 Specify the most recent revision to keep. All later revisions
\r
862 Discard the specified revision as well, keeping the nearest
\r
873 Assume you have local changes in "master", but you need to refetch "r2".
\r
875 <screen> r1---r2---r3 remotes/git-svn
\r
877 A---B master</screen>
\r
878 <simpara>Fix the ignore-paths or SVN permissions problem that caused "r2" to
\r
879 be incomplete in the first place. Then:</simpara>
\r
881 <literallayout>git svn reset -r2 -p
\r
882 git svn fetch</literallayout>
\r
884 <screen> r1---r2'--r3' remotes/git-svn
\r
886 r2---r3---A---B master</screen>
\r
887 <simpara>Then fixup "master" with <emphasis>git rebase</emphasis>.
\r
888 Do NOT use <emphasis>git merge</emphasis> or your history will not be compatible with a
\r
889 future <emphasis>dcommit</emphasis>!</simpara>
\r
891 <literallayout>git rebase --onto remotes/git-svn A^ master</literallayout>
\r
893 <screen> r1---r2'--r3' remotes/git-svn
\r
895 A'--B' master</screen>
\r
903 <simplesect id="_options">
\r
904 <title>OPTIONS</title>
\r
908 --shared[=(false|true|umask|group|all|world|everybody)]
\r
911 --template=<template_directory>
\r
915 Only used with the <emphasis>init</emphasis> command.
\r
916 These are passed directly to <emphasis>git init</emphasis>.
\r
925 --revision <arg>
\r
929 Used with the <emphasis>fetch</emphasis> command.
\r
931 <simpara>This allows revision ranges for partial/cauterized history
\r
932 to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
\r
933 $NUMBER:HEAD, and BASE:$NUMBER are all supported.</simpara>
\r
934 <simpara>This can allow you to make partial mirrors when running fetch;
\r
935 but is generally not recommended because history will be skipped
\r
936 and lost.</simpara>
\r
948 Only used with the <emphasis>set-tree</emphasis> command.
\r
950 <simpara>Read a list of commits from stdin and commit them in reverse
\r
951 order. Only the leading sha1 is read from each line, so
\r
952 <emphasis>git rev-list --pretty=oneline</emphasis> output can be used.</simpara>
\r
961 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
963 <simpara>Remove directories from the SVN tree if there are no files left
\r
964 behind. SVN can version empty directories, and they are not
\r
965 removed by default if there are no files left in them. git
\r
966 cannot version empty directories. Enabling this flag will make
\r
967 the commit to SVN act like git.</simpara>
\r
969 <literallayout>config key: svn.rmdir</literallayout>
\r
982 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
984 <simpara>Edit the commit message before committing to SVN. This is off by
\r
985 default for objects that are commits, and forced on when committing
\r
986 tree objects.</simpara>
\r
988 <literallayout>config key: svn.edit</literallayout>
\r
997 --find-copies-harder
\r
1001 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
1003 <simpara>They are both passed directly to <emphasis>git diff-tree</emphasis>; see
\r
1004 <xref linkend="git-diff-tree(1)" /> for more information.</simpara>
\r
1006 <literallayout>config key: svn.l
\r
1007 config key: svn.findcopiesharder</literallayout>
\r
1013 -A<filename>
\r
1016 --authors-file=<filename>
\r
1020 Syntax is compatible with the file used by <emphasis>git cvsimport</emphasis>:
\r
1022 <screen> loginname = Joe User <user@example.com></screen>
\r
1023 <simpara>If this option is specified and <emphasis>git svn</emphasis> encounters an SVN
\r
1024 committer name that does not exist in the authors-file, <emphasis>git svn</emphasis>
\r
1025 will abort operation. The user will then have to add the
\r
1026 appropriate entry. Re-running the previous <emphasis>git svn</emphasis> command
\r
1027 after the authors-file is modified should continue operation.</simpara>
\r
1029 <literallayout>config key: svn.authorsfile</literallayout>
\r
1035 --authors-prog=<filename>
\r
1039 If this option is specified, for each SVN committer name that
\r
1040 does not exist in the authors file, the given file is executed
\r
1041 with the committer name as the first argument. The program is
\r
1042 expected to return a single line of the form "Name <email>",
\r
1043 which will be treated as if included in the authors file.
\r
1056 Make <emphasis>git svn</emphasis> less verbose. Specify a second time to make it
\r
1057 even less verbose.
\r
1063 --repack[=<n>]
\r
1066 --repack-flags=<flags>
\r
1070 These should help keep disk usage sane for large fetches with
\r
1073 <simpara>--repack takes an optional argument for the number of revisions
\r
1074 to fetch before repacking. This defaults to repacking every
\r
1075 1000 commits fetched if no argument is specified.</simpara>
\r
1076 <simpara>--repack-flags are passed directly to <emphasis>git repack</emphasis>.</simpara>
\r
1078 <literallayout>config key: svn.repack
\r
1079 config key: svn.repackflags</literallayout>
\r
1091 -s<strategy>
\r
1094 --strategy=<strategy>
\r
1098 These are only used with the <emphasis>dcommit</emphasis> and <emphasis>rebase</emphasis> commands.
\r
1100 <simpara>Passed directly to <emphasis>git rebase</emphasis> when using <emphasis>dcommit</emphasis> if a
\r
1101 <emphasis>git reset</emphasis> cannot be used (see <emphasis>dcommit</emphasis>).</simpara>
\r
1113 This can be used with the <emphasis>dcommit</emphasis>, <emphasis>rebase</emphasis>, <emphasis>branch</emphasis> and
\r
1114 <emphasis>tag</emphasis> commands.
\r
1116 <simpara>For <emphasis>dcommit</emphasis>, print out the series of git arguments that would show
\r
1117 which diffs would be committed to SVN.</simpara>
\r
1118 <simpara>For <emphasis>rebase</emphasis>, display the local branch associated with the upstream svn
\r
1119 repository associated with the current branch and the URL of svn
\r
1120 repository that will be fetched from.</simpara>
\r
1121 <simpara>For <emphasis>branch</emphasis> and <emphasis>tag</emphasis>, display the urls that will be used for copying when
\r
1122 creating the branch or tag.</simpara>
\r
1131 When retrieving svn commits into git (as part of <emphasis>fetch</emphasis>, <emphasis>rebase</emphasis>, or
\r
1132 <emphasis>dcommit</emphasis> operations), look for the first <emphasis>From:</emphasis> or <emphasis>Signed-off-by:</emphasis> line
\r
1133 in the log message and use that as the author string.
\r
1143 When committing to svn from git (as part of <emphasis>commit-diff</emphasis>, <emphasis>set-tree</emphasis> or <emphasis>dcommit</emphasis>
\r
1144 operations), if the existing log message doesn't already have a
\r
1145 <emphasis>From:</emphasis> or <emphasis>Signed-off-by:</emphasis> line, append a <emphasis>From:</emphasis> line based on the
\r
1146 git commit's author string. If you use this, then <emphasis>--use-log-author</emphasis>
\r
1147 will retrieve a valid author string for all commits.
\r
1153 <simplesect id="_advanced_options">
\r
1154 <title>ADVANCED OPTIONS</title>
\r
1158 -i<GIT_SVN_ID>
\r
1161 --id <GIT_SVN_ID>
\r
1165 This sets GIT_SVN_ID (instead of using the environment). This
\r
1166 allows the user to override the default refname to fetch from
\r
1167 when tracking a single URL. The <emphasis>log</emphasis> and <emphasis>dcommit</emphasis> commands
\r
1168 no longer require this switch as an argument.
\r
1174 -R<remote name>
\r
1177 --svn-remote <remote name>
\r
1181 Specify the [svn-remote "<remote name>"] section to use,
\r
1182 this allows SVN multiple repositories to be tracked.
\r
1193 This is especially helpful when we're tracking a directory
\r
1194 that has been moved around within the repository, or if we
\r
1195 started tracking a branch and never tracked the trunk it was
\r
1196 descended from. This feature is enabled by default, use
\r
1197 --no-follow-parent to disable it.
\r
1200 <literallayout>config key: svn.followparent</literallayout>
\r
1206 <simplesect id="_config_file_only_options">
\r
1207 <title>CONFIG FILE-ONLY OPTIONS</title>
\r
1214 svn-remote.<name>.noMetadata
\r
1218 This gets rid of the <emphasis>git-svn-id:</emphasis> lines at the end of every commit.
\r
1220 <simpara>This option can only be used for one-shot imports as <emphasis>git svn</emphasis>
\r
1221 will not be able to fetch again without metadata. Additionally,
\r
1222 if you lose your .git/svn/<emphasis role="strong">*/.rev_map.</emphasis> files, <emphasis>git svn</emphasis> will not
\r
1223 be able to rebuild them.</simpara>
\r
1224 <simpara>The <emphasis>git svn log</emphasis> command will not work on repositories using
\r
1225 this, either. Using this conflicts with the <emphasis>useSvmProps</emphasis>
\r
1226 option for (hopefully) obvious reasons.</simpara>
\r
1227 <simpara>This option is NOT recommended as it makes it difficult to track down
\r
1228 old references to SVN revision numbers in existing documentation, bug
\r
1229 reports and archives. If you plan to eventually migrate from SVN to git
\r
1230 and are certain about dropping SVN history, consider
\r
1231 <xref linkend="git-filter-branch(1)" /> instead. filter-branch also allows
\r
1232 reformatting of metadata for ease-of-reading and rewriting authorship
\r
1233 info for non-"svn.authorsFile" users.</simpara>
\r
1241 svn-remote.<name>.useSvmProps
\r
1245 This allows <emphasis>git svn</emphasis> to re-map repository URLs and UUIDs from
\r
1246 mirrors created using SVN::Mirror (or svk) for metadata.
\r
1248 <simpara>If an SVN revision has a property, "svm:headrev", it is likely
\r
1249 that the revision was created by SVN::Mirror (also used by SVK).
\r
1250 The property contains a repository UUID and a revision. We want
\r
1251 to make it look like we are mirroring the original URL, so
\r
1252 introduce a helper function that returns the original identity
\r
1253 URL and UUID, and use it when generating metadata in commit
\r
1254 messages.</simpara>
\r
1259 svn.useSvnsyncProps
\r
1262 svn-remote.<name>.useSvnsyncprops
\r
1266 Similar to the useSvmProps option; this is for users
\r
1267 of the svnsync(1) command distributed with SVN 1.4.x and
\r
1274 svn-remote.<name>.rewriteRoot
\r
1278 This allows users to create repositories from alternate
\r
1279 URLs. For example, an administrator could run <emphasis>git svn</emphasis> on the
\r
1280 server locally (accessing via file://) but wish to distribute
\r
1281 the repository with a public http:// or svn:// URL in the
\r
1282 metadata so users of it will see the public URL.
\r
1288 svn-remote.<name>.rewriteUUID
\r
1292 Similar to the useSvmProps option; this is for users who need
\r
1293 to remap the UUID manually. This may be useful in situations
\r
1294 where the original UUID is not available via either useSvmProps
\r
1295 or useSvnsyncProps.
\r
1301 svn-remote.<name>.pushurl
\r
1305 Similar to git's <emphasis>remote.<name>.pushurl</emphasis>, this key is designed
\r
1306 to be used in cases where <emphasis>url</emphasis> points to an SVN repository
\r
1307 via a read-only transport, to provide an alternate read/write
\r
1308 transport. It is assumed that both keys point to the same
\r
1309 repository. Unlike <emphasis>commiturl</emphasis>, <emphasis>pushurl</emphasis> is a base path. If
\r
1310 either <emphasis>commiturl</emphasis> or <emphasis>pushurl</emphasis> could be used, <emphasis>commiturl</emphasis>
\r
1317 svn.brokenSymlinkWorkaround
\r
1321 This disables potentially expensive checks to workaround
\r
1322 broken symlinks checked into SVN by broken clients. Set this
\r
1323 option to "false" if you track a SVN repository with many
\r
1324 empty blobs that are not symlinks. This option may be changed
\r
1325 while <emphasis>git svn</emphasis> is running and take effect on the next
\r
1326 revision fetched. If unset, <emphasis>git svn</emphasis> assumes this option to
\r
1333 svn.pathnameencoding
\r
1337 This instructs git svn to recode pathnames to a given encoding.
\r
1338 It can be used by windows users and by those who work in non-utf8
\r
1339 locales to avoid corrupted file names with non-ASCII characters.
\r
1340 Valid encodings are the ones supported by Perl's Encode module.
\r
1346 svn-remote.<name>.automkdirs
\r
1350 Normally, the "git svn clone" and "git svn rebase" commands
\r
1351 attempt to recreate empty directories that are in the
\r
1352 Subversion repository. If this option is set to "false", then
\r
1353 empty directories will only be created if the "git svn mkdirs"
\r
1354 command is run explicitly. If unset, <emphasis>git svn</emphasis> assumes this
\r
1355 option to be "true".
\r
1360 <simpara>Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
\r
1361 options all affect the metadata generated and used by <emphasis>git svn</emphasis>; they
\r
1362 <emphasis role="strong">must</emphasis> be set in the configuration file before any history is imported
\r
1363 and these settings should never be changed once they are set.</simpara>
\r
1364 <simpara>Additionally, only one of these options can be used per svn-remote
\r
1365 section because they affect the <emphasis>git-svn-id:</emphasis> metadata line, except
\r
1366 for rewriteRoot and rewriteUUID which can be used together.</simpara>
\r
1368 <simplesect id="_basic_examples">
\r
1369 <title>BASIC EXAMPLES</title>
\r
1370 <simpara>Tracking and contributing to the trunk of a Subversion-managed project:</simpara>
\r
1371 <screen># Clone a repo (like git clone):
\r
1372 git svn clone http://svn.example.com/project/trunk
\r
1373 # Enter the newly cloned directory:
\r
1375 # You should be on master branch, double-check with 'git branch'
\r
1377 # Do some work and commit locally to git:
\r
1379 # Something is committed to SVN, rebase your local changes against the
\r
1380 # latest changes in SVN:
\r
1382 # Now commit your changes (that were committed previously using git) to SVN,
\r
1383 # as well as automatically updating your working HEAD:
\r
1385 # Append svn:ignore settings to the default git exclude file:
\r
1386 git svn show-ignore >> .git/info/exclude</screen>
\r
1387 <simpara>Tracking and contributing to an entire Subversion-managed project
\r
1388 (complete with a trunk, tags and branches):</simpara>
\r
1389 <screen># Clone a repo (like git clone):
\r
1390 git svn clone http://svn.example.com/project -T trunk -b branches -t tags
\r
1391 # View all branches and tags you have cloned:
\r
1393 # Create a new branch in SVN
\r
1394 git svn branch waldo
\r
1395 # Reset your master to trunk (or any other branch, replacing 'trunk'
\r
1396 # with the appropriate name):
\r
1397 git reset --hard remotes/trunk
\r
1398 # You may only dcommit to one branch/tag/trunk at a time. The usage
\r
1399 # of dcommit/rebase/show-ignore should be the same as above.</screen>
\r
1400 <simpara>The initial <emphasis>git svn clone</emphasis> can be quite time-consuming
\r
1401 (especially for large Subversion repositories). If multiple
\r
1402 people (or one person with multiple machines) want to use
\r
1403 <emphasis>git svn</emphasis> to interact with the same Subversion repository, you can
\r
1404 do the initial <emphasis>git svn clone</emphasis> to a repository on a server and
\r
1405 have each person clone that repository with <emphasis>git clone</emphasis>:</simpara>
\r
1406 <screen># Do the initial import on a server
\r
1407 ssh server "cd /pub && git svn clone http://svn.example.com/project
\r
1408 # Clone locally - make sure the refs/remotes/ space matches the server
\r
1412 git remote add origin server:/pub/project
\r
1413 git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
\r
1415 # Prevent fetch/pull from remote git server in the future,
\r
1416 # we only want to use git svn for future updates
\r
1417 git config --remove-section remote.origin
\r
1418 # Create a local branch from one of the branches just fetched
\r
1419 git checkout -b master FETCH_HEAD
\r
1420 # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
\r
1421 git svn init http://svn.example.com/project
\r
1422 # Pull the latest changes from Subversion
\r
1423 git svn rebase</screen>
\r
1425 <simplesect id="_rebase_vs_pull_merge">
\r
1426 <title>REBASE VS. PULL/MERGE</title>
\r
1427 <simpara>Originally, <emphasis>git svn</emphasis> recommended that the <emphasis>remotes/git-svn</emphasis> branch be
\r
1428 pulled or merged from. This is because the author favored
\r
1429 <emphasis>git svn set-tree B</emphasis> to commit a single head rather than the
\r
1430 <emphasis>git svn set-tree A..B</emphasis> notation to commit multiple commits.</simpara>
\r
1431 <simpara>If you use <emphasis>git svn set-tree A..B</emphasis> to commit several diffs and you do
\r
1432 not have the latest remotes/git-svn merged into my-branch, you should
\r
1433 use <emphasis>git svn rebase</emphasis> to update your work branch instead of <emphasis>git pull</emphasis> or
\r
1434 <emphasis>git merge</emphasis>. <emphasis>pull</emphasis>/<emphasis>merge</emphasis> can cause non-linear history to be flattened
\r
1435 when committing into SVN, which can lead to merge commits reversing
\r
1436 previous commits in SVN.</simpara>
\r
1438 <simplesect id="_merge_tracking">
\r
1439 <title>MERGE TRACKING</title>
\r
1440 <simpara>While <emphasis>git svn</emphasis> can track
\r
1441 copy history (including branches and tags) for repositories adopting a
\r
1442 standard layout, it cannot yet represent merge history that happened
\r
1443 inside git back upstream to SVN users. Therefore it is advised that
\r
1444 users keep history as linear as possible inside git to ease
\r
1445 compatibility with SVN (see the CAVEATS section below).</simpara>
\r
1447 <simplesect id="_caveats">
\r
1448 <title>CAVEATS</title>
\r
1449 <simpara>For the sake of simplicity and interoperating with Subversion,
\r
1450 it is recommended that all <emphasis>git svn</emphasis> users clone, fetch and dcommit
\r
1451 directly from the SVN server, and avoid all <emphasis>git clone</emphasis>/<emphasis>pull</emphasis>/<emphasis>merge</emphasis>/<emphasis>push</emphasis>
\r
1452 operations between git repositories and branches. The recommended
\r
1453 method of exchanging code between git branches and users is
\r
1454 <emphasis>git format-patch</emphasis> and <emphasis>git am</emphasis>, or just 'dcommit'ing to the SVN repository.</simpara>
\r
1455 <simpara>Running <emphasis>git merge</emphasis> or <emphasis>git pull</emphasis> is NOT recommended on a branch you
\r
1456 plan to <emphasis>dcommit</emphasis> from because Subversion users cannot see any
\r
1457 merges you've made. Furthermore, if you merge or pull from a git branch
\r
1458 that is a mirror of an SVN branch, <emphasis>dcommit</emphasis> may commit to the wrong
\r
1460 <simpara>If you do merge, note the following rule: <emphasis>git svn dcommit</emphasis> will
\r
1461 attempt to commit on top of the SVN commit named in</simpara>
\r
1462 <screen>git log --grep=^git-svn-id: --first-parent -1</screen>
\r
1463 <simpara>You <emphasis>must</emphasis> therefore ensure that the most recent commit of the branch
\r
1464 you want to dcommit to is the <emphasis>first</emphasis> parent of the merge. Chaos will
\r
1465 ensue otherwise, especially if the first parent is an older commit on
\r
1466 the same SVN branch.</simpara>
\r
1467 <simpara><emphasis>git clone</emphasis> does not clone branches under the refs/remotes/ hierarchy or
\r
1468 any <emphasis>git svn</emphasis> metadata, or config. So repositories created and managed with
\r
1469 using <emphasis>git svn</emphasis> should use <emphasis>rsync</emphasis> for cloning, if cloning is to be done
\r
1471 <simpara>Since <emphasis>dcommit</emphasis> uses rebase internally, any git branches you <emphasis>git push</emphasis> to
\r
1472 before <emphasis>dcommit</emphasis> on will require forcing an overwrite of the existing ref
\r
1473 on the remote repository. This is generally considered bad practice,
\r
1474 see the <xref linkend="git-push(1)" /> documentation for details.</simpara>
\r
1475 <simpara>Do not use the --amend option of <xref linkend="git-commit(1)" /> on a change you've
\r
1476 already dcommitted. It is considered bad practice to --amend commits
\r
1477 you've already pushed to a remote repository for other users, and
\r
1478 dcommit with SVN is analogous to that.</simpara>
\r
1479 <simpara>When using multiple --branches or --tags, <emphasis>git svn</emphasis> does not automatically
\r
1480 handle name collisions (for example, if two branches from different paths have
\r
1481 the same name, or if a branch and a tag have the same name). In these cases,
\r
1482 use <emphasis>init</emphasis> to set up your git repository then, before your first <emphasis>fetch</emphasis>, edit
\r
1483 the .git/config file so that the branches and tags are associated with
\r
1484 different name spaces. For example:</simpara>
\r
1485 <literallayout class="monospaced">branches = stable/*:refs/remotes/svn/stable/*
\r
1486 branches = debug/*:refs/remotes/svn/debug/*</literallayout>
\r
1488 <simplesect id="_bugs">
\r
1489 <title>BUGS</title>
\r
1490 <simpara>We ignore all SVN properties except svn:executable. Any unhandled
\r
1491 properties are logged to $GIT_DIR/svn/<refname>/unhandled.log</simpara>
\r
1492 <simpara>Renamed and copied directories are not detected by git and hence not
\r
1493 tracked when committing to SVN. I do not plan on adding support for
\r
1494 this as it's quite difficult and time-consuming to get working for all
\r
1495 the possible corner cases (git doesn't do it, either). Committing
\r
1496 renamed and copied files is fully supported if they're similar enough
\r
1497 for git to detect them.</simpara>
\r
1499 <simplesect id="_configuration">
\r
1500 <title>CONFIGURATION</title>
\r
1501 <simpara><emphasis>git svn</emphasis> stores [svn-remote] configuration information in the
\r
1502 repository .git/config file. It is similar the core git
\r
1503 [remote] sections except <emphasis>fetch</emphasis> keys do not accept glob
\r
1504 arguments; but they are instead handled by the <emphasis>branches</emphasis>
\r
1505 and <emphasis>tags</emphasis> keys. Since some SVN repositories are oddly
\r
1506 configured with multiple projects glob expansions such those
\r
1507 listed below are allowed:</simpara>
\r
1508 <screen>[svn-remote "project-a"]
\r
1509 url = http://server.org/svn
\r
1510 fetch = trunk/project-a:refs/remotes/project-a/trunk
\r
1511 branches = branches/*/project-a:refs/remotes/project-a/branches/*
\r
1512 tags = tags/*/project-a:refs/remotes/project-a/tags/*</screen>
\r
1513 <simpara>Keep in mind that the <emphasis>*</emphasis> (asterisk) wildcard of the local ref
\r
1514 (right of the <emphasis>:</emphasis>) <emphasis role="strong">must</emphasis> be the farthest right path component;
\r
1515 however the remote wildcard may be anywhere as long as it's an
\r
1516 independent path component (surrounded by <emphasis>/</emphasis> or EOL). This
\r
1517 type of configuration is not automatically created by <emphasis>init</emphasis> and
\r
1518 should be manually entered with a text-editor or using <emphasis>git config</emphasis>.</simpara>
\r
1519 <simpara>It is also possible to fetch a subset of branches or tags by using a
\r
1520 comma-separated list of names within braces. For example:</simpara>
\r
1521 <screen>[svn-remote "huge-project"]
\r
1522 url = http://server.org/svn
\r
1523 fetch = trunk/src:refs/remotes/trunk
\r
1524 branches = branches/{red,green}/src:refs/remotes/branches/*
\r
1525 tags = tags/{1.0,2.0}/src:refs/remotes/tags/*</screen>
\r
1526 <simpara>Note that git-svn keeps track of the highest revision in which a branch
\r
1527 or tag has appeared. If the subset of branches or tags is changed after
\r
1528 fetching, then .git/svn/.metadata must be manually edited to remove (or
\r
1529 reset) branches-maxRev and/or tags-maxRev as appropriate.</simpara>
\r
1531 <simplesect id="_see_also">
\r
1532 <title>SEE ALSO</title>
\r
1533 <simpara><xref linkend="git-rebase(1)" /></simpara>
\r
1535 <simplesect id="_git">
\r
1536 <title>GIT</title>
\r
1537 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r