blob: 9229d45ad9a94047a7ce4f24543770ebc521ef61 [file] [log] [blame]
Junio C Hamano9ae1a062006-07-10 08:12:341git-svn(1)
2==========
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-svn - Bidirectional operation between a single Subversion branch and git
Junio C Hamano9ae1a062006-07-10 08:12:347
8SYNOPSIS
9--------
Junio C Hamanofce7c7e2008-07-02 03:06:3810'git svn' <command> [options] [arguments]
Junio C Hamano9ae1a062006-07-10 08:12:3411
12DESCRIPTION
13-----------
Junio C Hamanoba4b9282008-07-06 05:20:3114'git-svn' is a simple conduit for changesets between Subversion and git.
Junio C Hamano7f80ae82008-07-30 18:31:3515It provides a bidirectional flow of changes between a Subversion and a git
Junio C Hamanocb1c44f2008-08-06 06:19:3316repository.
Junio C Hamano9ae1a062006-07-10 08:12:3417
Junio C Hamano7f80ae82008-07-30 18:31:3518'git-svn' can track a single Subversion branch simply by using a
19URL to the branch, follow branches laid out in the Subversion recommended
20method (trunk, branches, tags directories) with the --stdlayout option, or
21follow branches in any layout with the -T/-t/-b options (see options to
22'init' below, and also the 'clone' command).
Junio C Hamano9ae1a062006-07-10 08:12:3423
Junio C Hamano7f80ae82008-07-30 18:31:3524Once tracking a Subversion branch (with any of the above methods), the git
25repository can be updated from Subversion by the 'fetch' command and
26Subversion updated from git by the 'dcommit' command.
Junio C Hamano9ae1a062006-07-10 08:12:3427
28COMMANDS
29--------
Junio C Hamano6b2cee12006-08-26 08:43:3130--
31
32'init'::
Junio C Hamano00cb3712007-02-23 11:13:5233Initializes an empty git repository with additional
Junio C Hamanoba4b9282008-07-06 05:20:3134metadata directories for 'git-svn'. The Subversion URL
Junio C Hamano00cb3712007-02-23 11:13:5235may be specified as a command-line argument, or as full
36URL arguments to -T/-t/-b. Optionally, the target
37directory to operate on can be specified as a second
38argument. Normally this command initializes the current
39directory.
40
Junio C Hamano67fad6d2007-05-06 08:53:1241-T<trunk_subdir>;;
42--trunk=<trunk_subdir>;;
43-t<tags_subdir>;;
44--tags=<tags_subdir>;;
45-b<branches_subdir>;;
46--branches=<branches_subdir>;;
Junio C Hamano377018d2007-08-23 08:41:3147-s;;
48--stdlayout;;
Junio C Hamano00cb3712007-02-23 11:13:5249These are optional command-line options for init. Each of
50these flags can point to a relative repository path
51(--tags=project/tags') or a full url
Junio C Hamano377018d2007-08-23 08:41:3152(--tags=https://foo.org/project/tags). The option --stdlayout is
53a shorthand way of setting trunk,tags,branches as the relative paths,
54which is the Subversion default. If any of the other options are given
55as well, they take precedence.
Junio C Hamano67fad6d2007-05-06 08:53:1256--no-metadata;;
Junio C Hamano00cb3712007-02-23 11:13:5257Set the 'noMetadata' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1258--use-svm-props;;
Junio C Hamano00cb3712007-02-23 11:13:5259Set the 'useSvmProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1260--use-svnsync-props;;
Junio C Hamano00cb3712007-02-23 11:13:5261Set the 'useSvnsyncProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1262--rewrite-root=<URL>;;
Junio C Hamano00cb3712007-02-23 11:13:5263Set the 'rewriteRoot' option in the [svn-remote] config.
Junio C Hamanodfccbb02008-05-26 01:16:1464--use-log-author;;
65When retrieving svn commits into git (as part of fetch, rebase, or
66dcommit operations), look for the first From: or Signed-off-by: line
67in the log message and use that as the author string.
68--add-author-from;;
69When committing to svn from git (as part of commit or dcommit
70operations), if the existing log message doesn't already have a
71From: or Signed-off-by: line, append a From: line based on the
72git commit's author string. If you use this, then --use-log-author
73will retrieve a valid author string for all commits.
Junio C Hamano67fad6d2007-05-06 08:53:1274--username=<USER>;;
Junio C Hamano00cb3712007-02-23 11:13:5275For transports that SVN handles authentication for (http,
76https, and plain svn), specify the username. For other
77transports (eg svn+ssh://), you must include the username in
78the URL, eg svn+ssh://foo@svn.bar.com/project
Junio C Hamano67fad6d2007-05-06 08:53:1279--prefix=<prefix>;;
Junio C Hamano00cb3712007-02-23 11:13:5280This allows one to specify a prefix which is prepended
81to the names of remotes if trunk/branches/tags are
82specified. The prefix does not automatically include a
83trailing slash, so be sure you include one in the
Junio C Hamano0a2ad892007-06-24 22:23:1284argument if that is what you want. If --branches/-b is
85specified, the prefix must include a trailing slash.
86Setting a prefix is useful if you wish to track multiple
87projects that share a common repository.
Junio C Hamano55344412009-04-12 18:31:1988--ignore-paths=<regex>;;
89When passed to 'init' or 'clone' this regular expression will
90be preserved as a config key. See 'fetch' for a description
91of '--ignore-paths'.
Junio C Hamano9ae1a062006-07-10 08:12:3492
Junio C Hamano6b2cee12006-08-26 08:43:3193'fetch'::
Junio C Hamano00cb3712007-02-23 11:13:5294Fetch unfetched revisions from the Subversion remote we are
95tracking. The name of the [svn-remote "..."] section in the
96.git/config file may be specified as an optional command-line
97argument.
Junio C Hamano9ae1a062006-07-10 08:12:3498
Junio C Hamano8f4ac0d2009-01-19 08:35:3699--localtime;;
100Store Git commit times in the local timezone instead of UTC. This
101makes 'git-log' (even without --date=local) show the same times
102that `svn log` would in the local timezone.
103
Junio C Hamano55344412009-04-12 18:31:19104--parent;;
105Fetch only from the SVN parent of the current HEAD.
106
Junio C Hamano8f4ac0d2009-01-19 08:35:36107This doesn't interfere with interoperating with the Subversion
108repository you cloned from, but if you wish for your local Git
109repository to be able to interoperate with someone else's local Git
110repository, either don't use this option or you should both use it in
111the same local timezone.
112
Junio C Hamanoa07e8162009-01-26 17:36:43113--ignore-paths=<regex>;;
Junio C Hamano55344412009-04-12 18:31:19114This allows one to specify a Perl regular expression that will
Junio C Hamanoa07e8162009-01-26 17:36:43115cause skipping of all matching paths from checkout from SVN.
Junio C Hamano55344412009-04-12 18:31:19116The '--ignore-paths' option should match for every 'fetch'
117(including automatic fetches due to 'clone', 'dcommit',
118'rebase', etc) on a given repository.
Junio C Hamanoa07e8162009-01-26 17:36:43119
Junio C Hamano55344412009-04-12 18:31:19120config key: svn-remote.<name>.ignore-paths
Junio C Hamanoa07e8162009-01-26 17:36:43121
Junio C Hamano55344412009-04-12 18:31:19122If the ignore-paths config key is set and the command
123line option is also given, both regular expressions
124will be used.
Junio C Hamanoa07e8162009-01-26 17:36:43125
Junio C Hamano55344412009-04-12 18:31:19126Examples:
127
128--ignore-paths="^doc" - skip "doc*" directory for every
129 fetch.
130
131--ignore-paths="^[^/]+/(?:branches|tags)" - skip
132 "branches" and "tags" of first level directories.
Junio C Hamanoa07e8162009-01-26 17:36:43133
Junio C Hamano00cb3712007-02-23 11:13:52134'clone'::
135Runs 'init' and 'fetch'. It will automatically create a
136directory based on the basename of the URL passed to it;
137or if a second argument is passed; it will create a directory
138and work within that. It accepts all arguments that the
139'init' and 'fetch' commands accept; with the exception of
140'--fetch-all'. After a repository is cloned, the 'fetch'
141command will be able to update revisions without affecting
142the working tree; and the 'rebase' command will be able
143to update the working tree with the latest changes.
Junio C Hamano9ae1a062006-07-10 08:12:34144
Junio C Hamano00cb3712007-02-23 11:13:52145'rebase'::
146This fetches revisions from the SVN parent of the current HEAD
147and rebases the current (uncommitted to SVN) work against it.
148
Junio C Hamanoba4b9282008-07-06 05:20:31149This works similarly to `svn update` or 'git-pull' except that
150it preserves linear history with 'git-rebase' instead of
Junio C Hamano610d1762008-11-28 06:27:13151'git-merge' for ease of dcommitting with 'git-svn'.
Junio C Hamano00cb3712007-02-23 11:13:52152
Junio C Hamanoba4b9282008-07-06 05:20:31153This accepts all options that 'git-svn fetch' and 'git-rebase'
Junio C Hamanofce7c7e2008-07-02 03:06:38154accept. However, '--fetch-all' only fetches from the current
Junio C Hamanoa3fd83c2007-03-02 10:34:36155[svn-remote], and not all [svn-remote] definitions.
Junio C Hamano00cb3712007-02-23 11:13:52156
Junio C Hamanoba4b9282008-07-06 05:20:31157Like 'git-rebase'; this requires that the working tree be clean
Junio C Hamanoa3fd83c2007-03-02 10:34:36158and have no uncommitted changes.
Junio C Hamano67fad6d2007-05-06 08:53:12159
Junio C Hamano103ad7f2007-03-14 11:19:26160-l;;
161--local;;
Junio C Hamanoba4b9282008-07-06 05:20:31162Do not fetch remotely; only run 'git-rebase' against the
Junio C Hamano103ad7f2007-03-14 11:19:26163last fetched commit from the upstream SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31164
165'dcommit'::
Junio C Hamano79770b62007-01-07 07:43:58166Commit each diff from a specified head directly to the SVN
Junio C Hamano6b2cee12006-08-26 08:43:31167repository, and then rebase or reset (depending on whether or
Junio C Hamano79770b62007-01-07 07:43:58168not there is a diff between SVN and head). This will create
169a revision in SVN for each commit in git.
Junio C Hamanoba4b9282008-07-06 05:20:31170It is recommended that you run 'git-svn' fetch and rebase (not
Junio C Hamano79770b62007-01-07 07:43:58171pull or merge) your commits against the latest changes in the
172SVN repository.
Junio C Hamano511162f2006-12-13 06:35:48173An optional command-line argument may be specified as an
174alternative to HEAD.
Junio C Hamano4bf6dca2006-12-21 02:25:57175This is advantageous over 'set-tree' (below) because it produces
Junio C Hamano6b2cee12006-08-26 08:43:31176cleaner, more linear history.
Junio C Hamano67fad6d2007-05-06 08:53:12177+
178--no-rebase;;
179After committing, do not rebase or reset.
Junio C Hamanofaa1e502008-08-10 03:55:58180--commit-url <URL>;;
181Commit to this SVN URL (the full path). This is intended to
182allow existing git-svn repositories created with one transport
183method (e.g. `svn://` or `http://` for anonymous read) to be
184reused if a user is later given access to an alternate transport
185method (e.g. `svn+ssh://` or `https://`) for commit.
186
Junio C Hamanoa50c35c2009-02-24 07:37:05187config key: svn-remote.<name>.commiturl
188
189config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
190
Junio C Hamanofaa1e502008-08-10 03:55:58191Using this option for any other purpose (don't ask)
192is very strongly discouraged.
Junio C Hamanoa3fd83c2007-03-02 10:34:36193--
Junio C Hamano6b2cee12006-08-26 08:43:31194
Junio C Hamanoa476efa2008-10-10 15:31:42195'branch'::
196Create a branch in the SVN repository.
197
198-m;;
199--message;;
200Allows to specify the commit message.
201
202-t;;
203--tag;;
204Create a tag by using the tags_subdir instead of the branches_subdir
205specified during git svn init.
206
207'tag'::
208Create a tag in the SVN repository. This is a shorthand for
209'branch -t'.
210
Junio C Hamano43d01342006-10-12 04:07:32211'log'::
212This should make it easy to look up svn log messages when svn
213users refer to -r/--revision numbers.
Junio C Hamanoa3fd83c2007-03-02 10:34:36214+
215The following features from `svn log' are supported:
216+
217--
218--revision=<n>[:<n>];;
219is supported, non-numeric args are not:
220HEAD, NEXT, BASE, PREV, etc ...
221-v/--verbose;;
222it's not completely compatible with the --verbose
223output in svn log, but reasonably close.
224--limit=<n>;;
225is NOT the same as --max-count, doesn't count
226merged/excluded commits
227--incremental;;
228supported
229--
230+
231New features:
232+
233--
234--show-commit;;
235shows the git commit sha1, as well
236--oneline;;
237our version of --pretty=oneline
238--
239+
Junio C Hamano24bc09a2008-02-28 00:27:44240NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
241client converts the UTC time to the local time (or based on the TZ=
242environment). This command has the same behaviour.
243+
Junio C Hamanoba4b9282008-07-06 05:20:31244Any other arguments are passed directly to 'git-log'
Junio C Hamano43d01342006-10-12 04:07:32245
Junio C Hamano9c334152008-02-12 03:18:52246'blame'::
Junio C Hamano869bb802008-05-12 00:29:47247 Show what revision and author last modified each line of a file. The
248 output of this mode is format-compatible with the output of
249 `svn blame' by default. Like the SVN blame command,
250 local uncommitted changes in the working copy are ignored;
251 the version of the file in the HEAD revision is annotated. Unknown
Junio C Hamanoba4b9282008-07-06 05:20:31252 arguments are passed directly to 'git-blame'.
Junio C Hamano9c334152008-02-12 03:18:52253+
Junio C Hamano869bb802008-05-12 00:29:47254--git-format;;
Junio C Hamanoba4b9282008-07-06 05:20:31255Produce output in the same format as 'git-blame', but with
Junio C Hamano869bb802008-05-12 00:29:47256SVN revision numbers instead of git commit hashes. In this mode,
257changes that haven't been committed to SVN (including local
258working-copy edits) are shown as revision 0.
Junio C Hamano9c334152008-02-12 03:18:52259
Junio C Hamanoa3fd83c2007-03-02 10:34:36260--
Junio C Hamano469d60e2007-04-29 18:30:34261'find-rev'::
262When given an SVN revision number of the form 'rN', returns the
Junio C Hamanob63afff2007-05-01 03:05:55263corresponding git commit hash (this can optionally be followed by a
264tree-ish to specify which branch should be searched). When given a
265tree-ish, returns the corresponding SVN revision number.
Junio C Hamano469d60e2007-04-29 18:30:34266
Junio C Hamano4bf6dca2006-12-21 02:25:57267'set-tree'::
Junio C Hamano43d01342006-10-12 04:07:32268You should consider using 'dcommit' instead of this command.
Junio C Hamano9ae1a062006-07-10 08:12:34269Commit specified commit or tree objects to SVN. This relies on
270your imported fetch data being up-to-date. This makes
271absolutely no attempts to do patching when committing to SVN, it
272simply overwrites files with those specified in the tree or
273commit. All merging is assumed to have taken place
Junio C Hamanoba4b9282008-07-06 05:20:31274independently of 'git-svn' functions.
Junio C Hamano9ae1a062006-07-10 08:12:34275
Junio C Hamano47d68a52008-05-06 06:35:40276'create-ignore'::
Junio C Hamano47d68a52008-05-06 06:35:40277Recursively finds the svn:ignore property on directories and
278creates matching .gitignore files. The resulting files are staged to
Junio C Hamanofeeb1be2008-05-22 00:53:35279be committed, but are not committed. Use -r/--revision to refer to a
Junio C Hamanocb1c44f2008-08-06 06:19:33280specific revision.
Junio C Hamano47d68a52008-05-06 06:35:40281
Junio C Hamano6b2cee12006-08-26 08:43:31282'show-ignore'::
Junio C Hamano9ae1a062006-07-10 08:12:34283Recursively finds and lists the svn:ignore property on
284directories. The output is suitable for appending to
285the $GIT_DIR/info/exclude file.
286
Junio C Hamano43d01342006-10-12 04:07:32287'commit-diff'::
288Commits the diff of two tree-ish arguments from the
Junio C Hamano7f80ae82008-07-30 18:31:35289command-line. This command does not rely on being inside an `git-svn
Junio C Hamanofce7c7e2008-07-02 03:06:38290init`-ed repository. This command takes three arguments, (a) the
Junio C Hamano43d01342006-10-12 04:07:32291original tree to diff against, (b) the new tree result, (c) the
292URL of the target Subversion repository. The final argument
Junio C Hamanoba4b9282008-07-06 05:20:31293(URL) may be omitted if you are working from a 'git-svn'-aware
294repository (that has been `init`-ed with 'git-svn').
Junio C Hamano23db8852006-11-09 23:35:53295The -r<revision> option is required for this.
Junio C Hamano43d01342006-10-12 04:07:32296
Junio C Hamanoa0970542007-11-23 08:43:30297'info'::
298Shows information about a file or directory similar to what
299`svn info' provides. Does not currently support a -r/--revision
300argument. Use the --url option to output only the value of the
301'URL:' field.
302
Junio C Hamanofeeb1be2008-05-22 00:53:35303'proplist'::
304Lists the properties stored in the Subversion repository about a
305given file or directory. Use -r/--revision to refer to a specific
306Subversion revision.
307
308'propget'::
309Gets the Subversion property given as the first argument, for a
310file. A specific revision can be specified with -r/--revision.
311
312'show-externals'::
313Shows the Subversion externals. Use -r/--revision to specify a
314specific revision.
315
Junio C Hamano6b2cee12006-08-26 08:43:31316--
317
Junio C Hamano9ae1a062006-07-10 08:12:34318OPTIONS
319-------
Junio C Hamano6b2cee12006-08-26 08:43:31320--
321
Junio C Hamano00cb3712007-02-23 11:13:52322--shared[={false|true|umask|group|all|world|everybody}]::
Junio C Hamano43d01342006-10-12 04:07:32323--template=<template_directory>::
324Only used with the 'init' command.
Junio C Hamanoba4b9282008-07-06 05:20:31325These are passed directly to 'git-init'.
Junio C Hamano43d01342006-10-12 04:07:32326
Junio C Hamano9ae1a062006-07-10 08:12:34327-r <ARG>::
328--revision <ARG>::
Junio C Hamano9ae1a062006-07-10 08:12:34329
Junio C Hamano00cb3712007-02-23 11:13:52330Used with the 'fetch' command.
Junio C Hamano9ae1a062006-07-10 08:12:34331
Junio C Hamano00cb3712007-02-23 11:13:52332This allows revision ranges for partial/cauterized history
333to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
334$NUMBER:HEAD, and BASE:$NUMBER are all supported.
Junio C Hamano6b2cee12006-08-26 08:43:31335
Junio C Hamano00cb3712007-02-23 11:13:52336This can allow you to make partial mirrors when running fetch;
337but is generally not recommended because history will be skipped
338and lost.
Junio C Hamano9ae1a062006-07-10 08:12:34339
340-::
341--stdin::
Junio C Hamano9ae1a062006-07-10 08:12:34342
Junio C Hamano4bf6dca2006-12-21 02:25:57343Only used with the 'set-tree' command.
Junio C Hamano6b2cee12006-08-26 08:43:31344
345Read a list of commits from stdin and commit them in reverse
346order. Only the leading sha1 is read from each line, so
Junio C Hamanoba4b9282008-07-06 05:20:31347'git-rev-list --pretty=oneline' output can be used.
Junio C Hamano9ae1a062006-07-10 08:12:34348
349--rmdir::
Junio C Hamano9ae1a062006-07-10 08:12:34350
Junio C Hamano4bf6dca2006-12-21 02:25:57351Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34352
Junio C Hamano6b2cee12006-08-26 08:43:31353Remove directories from the SVN tree if there are no files left
354behind. SVN can version empty directories, and they are not
355removed by default if there are no files left in them. git
356cannot version empty directories. Enabling this flag will make
357the commit to SVN act like git.
358
Junio C Hamano7ad22dc2007-01-29 02:55:48359config key: svn.rmdir
Junio C Hamano9ae1a062006-07-10 08:12:34360
361-e::
362--edit::
Junio C Hamano9ae1a062006-07-10 08:12:34363
Junio C Hamano4bf6dca2006-12-21 02:25:57364Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34365
Junio C Hamano6b2cee12006-08-26 08:43:31366Edit the commit message before committing to SVN. This is off by
367default for objects that are commits, and forced on when committing
368tree objects.
369
Junio C Hamano7ad22dc2007-01-29 02:55:48370config key: svn.edit
Junio C Hamano9ae1a062006-07-10 08:12:34371
372-l<num>::
373--find-copies-harder::
Junio C Hamano9ae1a062006-07-10 08:12:34374
Junio C Hamano4bf6dca2006-12-21 02:25:57375Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34376
Junio C Hamanoba4b9282008-07-06 05:20:31377They are both passed directly to 'git-diff-tree'; see
Junio C Hamano35738e82008-01-07 07:55:46378linkgit:git-diff-tree[1] for more information.
Junio C Hamano6b2cee12006-08-26 08:43:31379
380[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48381config key: svn.l
382config key: svn.findcopiesharder
Junio C Hamano9ae1a062006-07-10 08:12:34383
384-A<filename>::
385--authors-file=<filename>::
386
Junio C Hamano7f80ae82008-07-30 18:31:35387Syntax is compatible with the file used by 'git-cvsimport':
Junio C Hamano9ae1a062006-07-10 08:12:34388
389------------------------------------------------------------------------
Junio C Hamano6b2cee12006-08-26 08:43:31390loginname = Joe User <user@example.com>
Junio C Hamano9ae1a062006-07-10 08:12:34391------------------------------------------------------------------------
392
Junio C Hamanoba4b9282008-07-06 05:20:31393If this option is specified and 'git-svn' encounters an SVN
394committer name that does not exist in the authors-file, 'git-svn'
Junio C Hamano6b2cee12006-08-26 08:43:31395will abort operation. The user will then have to add the
Junio C Hamanoba4b9282008-07-06 05:20:31396appropriate entry. Re-running the previous 'git-svn' command
Junio C Hamano6b2cee12006-08-26 08:43:31397after the authors-file is modified should continue operation.
Junio C Hamano9ae1a062006-07-10 08:12:34398
Junio C Hamano7ad22dc2007-01-29 02:55:48399config key: svn.authorsfile
Junio C Hamano43d01342006-10-12 04:07:32400
401-q::
402--quiet::
Junio C Hamano9572e922009-04-02 06:52:03403Make 'git-svn' less verbose. Specify a second time to make it
404even less verbose.
Junio C Hamano43d01342006-10-12 04:07:32405
406--repack[=<n>]::
Junio C Hamanoa3fd83c2007-03-02 10:34:36407--repack-flags=<flags>::
Junio C Hamano43d01342006-10-12 04:07:32408
Junio C Hamanoa3fd83c2007-03-02 10:34:36409These should help keep disk usage sane for large fetches
410with many revisions.
Junio C Hamano43d01342006-10-12 04:07:32411
Junio C Hamanoa3fd83c2007-03-02 10:34:36412--repack takes an optional argument for the number of revisions
413to fetch before repacking. This defaults to repacking every
4141000 commits fetched if no argument is specified.
Junio C Hamano43d01342006-10-12 04:07:32415
Junio C Hamanoba4b9282008-07-06 05:20:31416--repack-flags are passed directly to 'git-repack'.
Junio C Hamanoa3fd83c2007-03-02 10:34:36417
418[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48419config key: svn.repack
420config key: svn.repackflags
Junio C Hamano6b2cee12006-08-26 08:43:31421
422-m::
423--merge::
424-s<strategy>::
425--strategy=<strategy>::
426
Junio C Hamano00cb3712007-02-23 11:13:52427These are only used with the 'dcommit' and 'rebase' commands.
Junio C Hamano6b2cee12006-08-26 08:43:31428
Junio C Hamanoba4b9282008-07-06 05:20:31429Passed directly to 'git-rebase' when using 'dcommit' if a
430'git-reset' cannot be used (see 'dcommit').
Junio C Hamano6b2cee12006-08-26 08:43:31431
432-n::
433--dry-run::
434
Junio C Hamanoa476efa2008-10-10 15:31:42435This can be used with the 'dcommit', 'rebase', 'branch' and 'tag'
436commands.
Junio C Hamano6b2cee12006-08-26 08:43:31437
Junio C Hamano9e1793f2008-06-02 07:31:16438For 'dcommit', print out the series of git arguments that would show
Junio C Hamano6b2cee12006-08-26 08:43:31439which diffs would be committed to SVN.
440
Junio C Hamano9e1793f2008-06-02 07:31:16441For 'rebase', display the local branch associated with the upstream svn
442repository associated with the current branch and the URL of svn
443repository that will be fetched from.
444
Junio C Hamanoa476efa2008-10-10 15:31:42445For 'branch' and 'tag', display the urls that will be used for copying when
446creating the branch or tag.
447
Junio C Hamano6b2cee12006-08-26 08:43:31448--
Junio C Hamano9ae1a062006-07-10 08:12:34449
450ADVANCED OPTIONS
451----------------
Junio C Hamano6b2cee12006-08-26 08:43:31452--
453
Junio C Hamano9ae1a062006-07-10 08:12:34454-i<GIT_SVN_ID>::
455--id <GIT_SVN_ID>::
Junio C Hamano6b2cee12006-08-26 08:43:31456
Junio C Hamano00cb3712007-02-23 11:13:52457This sets GIT_SVN_ID (instead of using the environment). This
458allows the user to override the default refname to fetch from
459when tracking a single URL. The 'log' and 'dcommit' commands
460no longer require this switch as an argument.
461
462-R<remote name>::
463--svn-remote <remote name>::
464Specify the [svn-remote "<remote name>"] section to use,
465this allows SVN multiple repositories to be tracked.
466Default: "svn"
Junio C Hamano6b2cee12006-08-26 08:43:31467
Junio C Hamano43d01342006-10-12 04:07:32468--follow-parent::
469This is especially helpful when we're tracking a directory
470that has been moved around within the repository, or if we
471started tracking a branch and never tracked the trunk it was
Junio C Hamano00cb3712007-02-23 11:13:52472descended from. This feature is enabled by default, use
473--no-follow-parent to disable it.
Junio C Hamano43d01342006-10-12 04:07:32474
Junio C Hamano7ad22dc2007-01-29 02:55:48475config key: svn.followparent
Junio C Hamano43d01342006-10-12 04:07:32476
Junio C Hamano00cb3712007-02-23 11:13:52477--
478CONFIG FILE-ONLY OPTIONS
479------------------------
480--
481
482svn.noMetadata::
483svn-remote.<name>.noMetadata::
Junio C Hamano43d01342006-10-12 04:07:32484
Junio C Hamanofce7c7e2008-07-02 03:06:38485This gets rid of the 'git-svn-id:' lines at the end of every commit.
Junio C Hamano43d01342006-10-12 04:07:32486
Junio C Hamanoba4b9282008-07-06 05:20:31487If you lose your .git/svn/git-svn/.rev_db file, 'git-svn' will not
Junio C Hamanoa3fd83c2007-03-02 10:34:36488be able to rebuild it and you won't be able to fetch again,
489either. This is fine for one-shot imports.
490
Junio C Hamanoba4b9282008-07-06 05:20:31491The 'git-svn log' command will not work on repositories using
Junio C Hamanoa3fd83c2007-03-02 10:34:36492this, either. Using this conflicts with the 'useSvmProps'
493option for (hopefully) obvious reasons.
Junio C Hamano43d01342006-10-12 04:07:32494
Junio C Hamano00cb3712007-02-23 11:13:52495svn.useSvmProps::
496svn-remote.<name>.useSvmProps::
Junio C Hamano43d01342006-10-12 04:07:32497
Junio C Hamanoba4b9282008-07-06 05:20:31498This allows 'git-svn' to re-map repository URLs and UUIDs from
Junio C Hamanoa3fd83c2007-03-02 10:34:36499mirrors created using SVN::Mirror (or svk) for metadata.
500
501If an SVN revision has a property, "svm:headrev", it is likely
502that the revision was created by SVN::Mirror (also used by SVK).
503The property contains a repository UUID and a revision. We want
504to make it look like we are mirroring the original URL, so
505introduce a helper function that returns the original identity
506URL and UUID, and use it when generating metadata in commit
507messages.
Junio C Hamano9ae1a062006-07-10 08:12:34508
Junio C Hamano00cb3712007-02-23 11:13:52509svn.useSvnsyncProps::
510svn-remote.<name>.useSvnsyncprops::
511Similar to the useSvmProps option; this is for users
512of the svnsync(1) command distributed with SVN 1.4.x and
513later.
Junio C Hamano9ae1a062006-07-10 08:12:34514
Junio C Hamano00cb3712007-02-23 11:13:52515svn-remote.<name>.rewriteRoot::
516This allows users to create repositories from alternate
Junio C Hamanoba4b9282008-07-06 05:20:31517URLs. For example, an administrator could run 'git-svn' on the
Junio C Hamano00cb3712007-02-23 11:13:52518server locally (accessing via file://) but wish to distribute
519the repository with a public http:// or svn:// URL in the
520metadata so users of it will see the public URL.
Junio C Hamano6b2cee12006-08-26 08:43:31521
Junio C Hamanob3250062009-02-11 20:16:50522svn.brokenSymlinkWorkaround::
523This disables potentially expensive checks to workaround broken symlinks
524checked into SVN by broken clients. Set this option to "false" if you
525track a SVN repository with many empty blobs that are not symlinks.
526This option may be changed while "git-svn" is running and take effect on
527the next revision fetched. If unset, git-svn assumes this option to be
528"true".
529
Junio C Hamano0538b892008-06-20 04:18:33530--
531
Junio C Hamano00cb3712007-02-23 11:13:52532Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
Junio C Hamanoba4b9282008-07-06 05:20:31533options all affect the metadata generated and used by 'git-svn'; they
Junio C Hamano00cb3712007-02-23 11:13:52534*must* be set in the configuration file before any history is imported
535and these settings should never be changed once they are set.
Junio C Hamano9ae1a062006-07-10 08:12:34536
Junio C Hamano00cb3712007-02-23 11:13:52537Additionally, only one of these four options can be used per-svn-remote
538section because they affect the 'git-svn-id:' metadata line.
Junio C Hamano47c1e3c2006-09-25 04:45:55539
Junio C Hamano9ae1a062006-07-10 08:12:34540
Junio C Hamanoa3fd83c2007-03-02 10:34:36541BASIC EXAMPLES
542--------------
Junio C Hamano9ae1a062006-07-10 08:12:34543
Junio C Hamano764a6672007-10-23 01:23:31544Tracking and contributing to the trunk of a Subversion-managed project:
Junio C Hamano9ae1a062006-07-10 08:12:34545
546------------------------------------------------------------------------
Junio C Hamano00cb3712007-02-23 11:13:52547# Clone a repo (like git clone):
Junio C Hamanoa476efa2008-10-10 15:31:42548git svn clone http://svn.example.com/project/trunk
Junio C Hamano00cb3712007-02-23 11:13:52549# Enter the newly cloned directory:
550cd trunk
551# You should be on master branch, double-check with git-branch
552git branch
553# Do some work and commit locally to git:
554git commit ...
555# Something is committed to SVN, rebase your local changes against the
556# latest changes in SVN:
Junio C Hamanofce7c7e2008-07-02 03:06:38557git svn rebase
Junio C Hamano00cb3712007-02-23 11:13:52558# Now commit your changes (that were committed previously using git) to SVN,
559# as well as automatically updating your working HEAD:
Junio C Hamanofce7c7e2008-07-02 03:06:38560git svn dcommit
Junio C Hamano9ae1a062006-07-10 08:12:34561# Append svn:ignore settings to the default git exclude file:
Junio C Hamanofce7c7e2008-07-02 03:06:38562git svn show-ignore >> .git/info/exclude
Junio C Hamano9ae1a062006-07-10 08:12:34563------------------------------------------------------------------------
564
Junio C Hamanoa8d072a2007-01-05 07:46:25565Tracking and contributing to an entire Subversion-managed project
566(complete with a trunk, tags and branches):
Junio C Hamanoa8d072a2007-01-05 07:46:25567
568------------------------------------------------------------------------
Junio C Hamano00cb3712007-02-23 11:13:52569# Clone a repo (like git clone):
Junio C Hamanoa476efa2008-10-10 15:31:42570git svn clone http://svn.example.com/project -T trunk -b branches -t tags
Junio C Hamano00cb3712007-02-23 11:13:52571# View all branches and tags you have cloned:
572git branch -r
Junio C Hamanoa476efa2008-10-10 15:31:42573# Create a new branch in SVN
574 git svn branch waldo
Junio C Hamano00cb3712007-02-23 11:13:52575# Reset your master to trunk (or any other branch, replacing 'trunk'
576# with the appropriate name):
577git reset --hard remotes/trunk
578# You may only dcommit to one branch/tag/trunk at a time. The usage
Junio C Hamanoa3fd83c2007-03-02 10:34:36579# of dcommit/rebase/show-ignore should be the same as above.
Junio C Hamanoa8d072a2007-01-05 07:46:25580------------------------------------------------------------------------
581
Junio C Hamanoba4b9282008-07-06 05:20:31582The initial 'git-svn clone' can be quite time-consuming
Junio C Hamanoe9bfa9b2007-08-07 06:06:11583(especially for large Subversion repositories). If multiple
584people (or one person with multiple machines) want to use
Junio C Hamanoba4b9282008-07-06 05:20:31585'git-svn' to interact with the same Subversion repository, you can
586do the initial 'git-svn clone' to a repository on a server and
587have each person clone that repository with 'git-clone':
Junio C Hamanoe9bfa9b2007-08-07 06:06:11588
589------------------------------------------------------------------------
590# Do the initial import on a server
Junio C Hamanoa476efa2008-10-10 15:31:42591ssh server "cd /pub && git svn clone http://svn.example.com/project
Junio C Hamanof7bb6692008-01-27 08:23:46592# Clone locally - make sure the refs/remotes/ space matches the server
593mkdir project
594cd project
Junio C Hamanofce7c7e2008-07-02 03:06:38595git init
Junio C Hamanof7bb6692008-01-27 08:23:46596git remote add origin server:/pub/project
Junio C Hamano9e7b3f32008-06-29 08:49:03597git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
Junio C Hamanof7bb6692008-01-27 08:23:46598git fetch
Junio C Hamanod3452a02008-11-15 08:07:55599# Create a local branch from one of the branches just fetched
600git checkout -b master FETCH_HEAD
Junio C Hamanoe9bfa9b2007-08-07 06:06:11601# Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)
Junio C Hamanoa476efa2008-10-10 15:31:42602git svn init http://svn.example.com/project
Junio C Hamanoe9bfa9b2007-08-07 06:06:11603# Pull the latest changes from Subversion
Junio C Hamanofce7c7e2008-07-02 03:06:38604git svn rebase
Junio C Hamanoe9bfa9b2007-08-07 06:06:11605------------------------------------------------------------------------
606
Junio C Hamano79770b62007-01-07 07:43:58607REBASE VS. PULL/MERGE
608---------------------
Junio C Hamano6b2cee12006-08-26 08:43:31609
Junio C Hamanoba4b9282008-07-06 05:20:31610Originally, 'git-svn' recommended that the 'remotes/git-svn' branch be
Junio C Hamano79770b62007-01-07 07:43:58611pulled or merged from. This is because the author favored
Junio C Hamanofce7c7e2008-07-02 03:06:38612`git svn set-tree B` to commit a single head rather than the
613`git svn set-tree A..B` notation to commit multiple commits.
Junio C Hamano6b2cee12006-08-26 08:43:31614
Junio C Hamanofce7c7e2008-07-02 03:06:38615If you use `git svn set-tree A..B` to commit several diffs and you do
Junio C Hamano79770b62007-01-07 07:43:58616not have the latest remotes/git-svn merged into my-branch, you should
Junio C Hamanofce7c7e2008-07-02 03:06:38617use `git svn rebase` to update your work branch instead of `git pull` or
618`git merge`. `pull`/`merge' can cause non-linear history to be flattened
Junio C Hamano79770b62007-01-07 07:43:58619when committing into SVN, which can lead to merge commits reversing
620previous commits in SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31621
Junio C Hamano9ae1a062006-07-10 08:12:34622DESIGN PHILOSOPHY
623-----------------
624Merge tracking in Subversion is lacking and doing branched development
Junio C Hamanoba4b9282008-07-06 05:20:31625with Subversion can be cumbersome as a result. While 'git-svn' can track
Junio C Hamanod2d9ae12007-09-19 02:27:57626copy history (including branches and tags) for repositories adopting a
627standard layout, it cannot yet represent merge history that happened
628inside git back upstream to SVN users. Therefore it is advised that
629users keep history as linear as possible inside git to ease
630compatibility with SVN (see the CAVEATS section below).
Junio C Hamano9ae1a062006-07-10 08:12:34631
Junio C Hamanobdebabb2007-08-23 00:25:09632CAVEATS
633-------
634
635For the sake of simplicity and interoperating with a less-capable system
Junio C Hamanoba4b9282008-07-06 05:20:31636(SVN), it is recommended that all 'git-svn' users clone, fetch and dcommit
637directly from the SVN server, and avoid all 'git-clone'/'pull'/'merge'/'push'
Junio C Hamanobdebabb2007-08-23 00:25:09638operations between git repositories and branches. The recommended
639method of exchanging code between git branches and users is
Junio C Hamanoba4b9282008-07-06 05:20:31640'git-format-patch' and 'git-am', or just 'dcommit'ing to the SVN repository.
Junio C Hamanobdebabb2007-08-23 00:25:09641
Junio C Hamanoba4b9282008-07-06 05:20:31642Running 'git-merge' or 'git-pull' is NOT recommended on a branch you
Junio C Hamanofce7c7e2008-07-02 03:06:38643plan to 'dcommit' from. Subversion does not represent merges in any
Junio C Hamanobdebabb2007-08-23 00:25:09644reasonable or useful fashion; so users using Subversion cannot see any
645merges you've made. Furthermore, if you merge or pull from a git branch
Junio C Hamanofce7c7e2008-07-02 03:06:38646that is a mirror of an SVN branch, 'dcommit' may commit to the wrong
Junio C Hamanobdebabb2007-08-23 00:25:09647branch.
648
Junio C Hamanoba4b9282008-07-06 05:20:31649'git-clone' does not clone branches under the refs/remotes/ hierarchy or
650any 'git-svn' metadata, or config. So repositories created and managed with
651using 'git-svn' should use 'rsync' for cloning, if cloning is to be done
Junio C Hamanobdebabb2007-08-23 00:25:09652at all.
653
Junio C Hamanoba4b9282008-07-06 05:20:31654Since 'dcommit' uses rebase internally, any git branches you 'git-push' to
Junio C Hamanofce7c7e2008-07-02 03:06:38655before 'dcommit' on will require forcing an overwrite of the existing ref
Junio C Hamanobdebabb2007-08-23 00:25:09656on the remote repository. This is generally considered bad practice,
Junio C Hamanofce7c7e2008-07-02 03:06:38657see the linkgit:git-push[1] documentation for details.
Junio C Hamanobdebabb2007-08-23 00:25:09658
Junio C Hamanofce7c7e2008-07-02 03:06:38659Do not use the --amend option of linkgit:git-commit[1] on a change you've
Junio C Hamanobdebabb2007-08-23 00:25:09660already dcommitted. It is considered bad practice to --amend commits
661you've already pushed to a remote repository for other users, and
662dcommit with SVN is analogous to that.
663
Junio C Hamano9ae1a062006-07-10 08:12:34664BUGS
665----
Junio C Hamano43d01342006-10-12 04:07:32666
Junio C Hamano00cb3712007-02-23 11:13:52667We ignore all SVN properties except svn:executable. Any unhandled
668properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
Junio C Hamano9ae1a062006-07-10 08:12:34669
Junio C Hamano9ae1a062006-07-10 08:12:34670Renamed and copied directories are not detected by git and hence not
671tracked when committing to SVN. I do not plan on adding support for
672this as it's quite difficult and time-consuming to get working for all
Junio C Hamano00cb3712007-02-23 11:13:52673the possible corner cases (git doesn't do it, either). Committing
674renamed and copied files are fully supported if they're similar enough
675for git to detect them.
676
677CONFIGURATION
678-------------
679
Junio C Hamanoba4b9282008-07-06 05:20:31680'git-svn' stores [svn-remote] configuration information in the
Junio C Hamano00cb3712007-02-23 11:13:52681repository .git/config file. It is similar the core git
682[remote] sections except 'fetch' keys do not accept glob
683arguments; but they are instead handled by the 'branches'
684and 'tags' keys. Since some SVN repositories are oddly
685configured with multiple projects glob expansions such those
686listed below are allowed:
687
688------------------------------------------------------------------------
689[svn-remote "project-a"]
690url = http://server.org/svn
Junio C Hamano9572e922009-04-02 06:52:03691fetch = trunk/project-a:refs/remotes/project-a/trunk
Junio C Hamano00cb3712007-02-23 11:13:52692branches = branches/*/project-a:refs/remotes/project-a/branches/*
693tags = tags/*/project-a:refs/remotes/project-a/tags/*
Junio C Hamano00cb3712007-02-23 11:13:52694------------------------------------------------------------------------
695
696Keep in mind that the '*' (asterisk) wildcard of the local ref
Junio C Hamano7d9e9bd2007-08-29 07:31:47697(right of the ':') *must* be the farthest right path component;
Junio C Hamano00cb3712007-02-23 11:13:52698however the remote wildcard may be anywhere as long as it's own
Junio C Hamanoa6387422007-08-25 03:54:27699independent path component (surrounded by '/' or EOL). This
Junio C Hamano00cb3712007-02-23 11:13:52700type of configuration is not automatically created by 'init' and
Junio C Hamanoba4b9282008-07-06 05:20:31701should be manually entered with a text-editor or using 'git-config'.
Junio C Hamano9ae1a062006-07-10 08:12:34702
Junio C Hamano6b2cee12006-08-26 08:43:31703SEE ALSO
704--------
Junio C Hamano35738e82008-01-07 07:55:46705linkgit:git-rebase[1]
Junio C Hamano6b2cee12006-08-26 08:43:31706
Junio C Hamano9ae1a062006-07-10 08:12:34707Author
708------
709Written by Eric Wong <normalperson@yhbt.net>.
710
711Documentation
712-------------
713Written by Eric Wong <normalperson@yhbt.net>.