blob: 7e9b9a042347bf286c6ea523bef1952f0c72dec9 [file] [log] [blame]
Junio C Hamano9ae1a062006-07-10 08:12:341git-svn(1)
2==========
3
4NAME
5----
Junio C Hamano688eae02009-06-28 05:19:506git-svn - Bidirectional operation between a Subversion repository 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 Hamano688eae02009-06-28 05:19:5018'git-svn' can track a standard Subversion repository,
19following the common "trunk/branches/tags" layout, with the --stdlayout option.
20It can also follow branches and tags in any layout with the -T/-t/-b options
21(see options to 'init' below, and also the 'clone' command).
Junio C Hamano9ae1a062006-07-10 08:12:3422
Junio C Hamano688eae02009-06-28 05:19:5023Once tracking a Subversion repository (with any of the above methods), the git
Junio C Hamano7f80ae82008-07-30 18:31:3524repository can be updated from Subversion by the 'fetch' command and
25Subversion updated from git by the 'dcommit' command.
Junio C Hamano9ae1a062006-07-10 08:12:3426
27COMMANDS
28--------
Junio C Hamano6b2cee12006-08-26 08:43:3129--
30
31'init'::
Junio C Hamano00cb3712007-02-23 11:13:5232Initializes an empty git repository with additional
Junio C Hamanoba4b9282008-07-06 05:20:3133metadata directories for 'git-svn'. The Subversion URL
Junio C Hamano00cb3712007-02-23 11:13:5234may be specified as a command-line argument, or as full
35URL arguments to -T/-t/-b. Optionally, the target
36directory to operate on can be specified as a second
37argument. Normally this command initializes the current
38directory.
39
Junio C Hamano67fad6d2007-05-06 08:53:1240-T<trunk_subdir>;;
41--trunk=<trunk_subdir>;;
42-t<tags_subdir>;;
43--tags=<tags_subdir>;;
44-b<branches_subdir>;;
45--branches=<branches_subdir>;;
Junio C Hamano377018d2007-08-23 08:41:3146-s;;
47--stdlayout;;
Junio C Hamano00cb3712007-02-23 11:13:5248These are optional command-line options for init. Each of
49these flags can point to a relative repository path
Junio C Hamano688eae02009-06-28 05:19:5050(--tags=project/tags) or a full url
51(--tags=https://foo.org/project/tags).
52You can specify more than one --tags and/or --branches options, in case
53your Subversion repository places tags or branches under multiple paths.
54The option --stdlayout is
Junio C Hamano377018d2007-08-23 08:41:3155a shorthand way of setting trunk,tags,branches as the relative paths,
56which is the Subversion default. If any of the other options are given
57as well, they take precedence.
Junio C Hamano67fad6d2007-05-06 08:53:1258--no-metadata;;
Junio C Hamano00cb3712007-02-23 11:13:5259Set the 'noMetadata' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1260--use-svm-props;;
Junio C Hamano00cb3712007-02-23 11:13:5261Set the 'useSvmProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1262--use-svnsync-props;;
Junio C Hamano00cb3712007-02-23 11:13:5263Set the 'useSvnsyncProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1264--rewrite-root=<URL>;;
Junio C Hamano00cb3712007-02-23 11:13:5265Set the 'rewriteRoot' option in the [svn-remote] config.
Junio C Hamanodfccbb02008-05-26 01:16:1466--use-log-author;;
67When retrieving svn commits into git (as part of fetch, rebase, or
68dcommit operations), look for the first From: or Signed-off-by: line
69in the log message and use that as the author string.
70--add-author-from;;
71When committing to svn from git (as part of commit or dcommit
72operations), if the existing log message doesn't already have a
73From: or Signed-off-by: line, append a From: line based on the
74git commit's author string. If you use this, then --use-log-author
75will retrieve a valid author string for all commits.
Junio C Hamano67fad6d2007-05-06 08:53:1276--username=<USER>;;
Junio C Hamano00cb3712007-02-23 11:13:5277For transports that SVN handles authentication for (http,
78https, and plain svn), specify the username. For other
79transports (eg svn+ssh://), you must include the username in
80the URL, eg svn+ssh://foo@svn.bar.com/project
Junio C Hamano67fad6d2007-05-06 08:53:1281--prefix=<prefix>;;
Junio C Hamano00cb3712007-02-23 11:13:5282This allows one to specify a prefix which is prepended
83to the names of remotes if trunk/branches/tags are
84specified. The prefix does not automatically include a
85trailing slash, so be sure you include one in the
Junio C Hamano0a2ad892007-06-24 22:23:1286argument if that is what you want. If --branches/-b is
87specified, the prefix must include a trailing slash.
88Setting a prefix is useful if you wish to track multiple
89projects that share a common repository.
Junio C Hamano55344412009-04-12 18:31:1990--ignore-paths=<regex>;;
91When passed to 'init' or 'clone' this regular expression will
92be preserved as a config key. See 'fetch' for a description
93of '--ignore-paths'.
Junio C Hamano9ae1a062006-07-10 08:12:3494
Junio C Hamano6b2cee12006-08-26 08:43:3195'fetch'::
Junio C Hamano00cb3712007-02-23 11:13:5296Fetch unfetched revisions from the Subversion remote we are
97tracking. The name of the [svn-remote "..."] section in the
98.git/config file may be specified as an optional command-line
99argument.
Junio C Hamano9ae1a062006-07-10 08:12:34100
Junio C Hamano8f4ac0d2009-01-19 08:35:36101--localtime;;
102Store Git commit times in the local timezone instead of UTC. This
103makes 'git-log' (even without --date=local) show the same times
104that `svn log` would in the local timezone.
105
Junio C Hamano55344412009-04-12 18:31:19106--parent;;
107Fetch only from the SVN parent of the current HEAD.
108
Junio C Hamano8f4ac0d2009-01-19 08:35:36109This doesn't interfere with interoperating with the Subversion
110repository you cloned from, but if you wish for your local Git
111repository to be able to interoperate with someone else's local Git
112repository, either don't use this option or you should both use it in
113the same local timezone.
114
Junio C Hamanoa07e8162009-01-26 17:36:43115--ignore-paths=<regex>;;
Junio C Hamano55344412009-04-12 18:31:19116This allows one to specify a Perl regular expression that will
Junio C Hamanoa07e8162009-01-26 17:36:43117cause skipping of all matching paths from checkout from SVN.
Junio C Hamano55344412009-04-12 18:31:19118The '--ignore-paths' option should match for every 'fetch'
119(including automatic fetches due to 'clone', 'dcommit',
120'rebase', etc) on a given repository.
Junio C Hamanoa07e8162009-01-26 17:36:43121
Junio C Hamano55344412009-04-12 18:31:19122config key: svn-remote.<name>.ignore-paths
Junio C Hamanoa07e8162009-01-26 17:36:43123
Junio C Hamano55344412009-04-12 18:31:19124If the ignore-paths config key is set and the command
125line option is also given, both regular expressions
126will be used.
Junio C Hamanoa07e8162009-01-26 17:36:43127
Junio C Hamano55344412009-04-12 18:31:19128Examples:
129
130--ignore-paths="^doc" - skip "doc*" directory for every
131 fetch.
132
133--ignore-paths="^[^/]+/(?:branches|tags)" - skip
134 "branches" and "tags" of first level directories.
Junio C Hamanoa07e8162009-01-26 17:36:43135
Junio C Hamano00cb3712007-02-23 11:13:52136'clone'::
137Runs 'init' and 'fetch'. It will automatically create a
138directory based on the basename of the URL passed to it;
139or if a second argument is passed; it will create a directory
140and work within that. It accepts all arguments that the
141'init' and 'fetch' commands accept; with the exception of
142'--fetch-all'. After a repository is cloned, the 'fetch'
143command will be able to update revisions without affecting
144the working tree; and the 'rebase' command will be able
145to update the working tree with the latest changes.
Junio C Hamano9ae1a062006-07-10 08:12:34146
Junio C Hamano00cb3712007-02-23 11:13:52147'rebase'::
148This fetches revisions from the SVN parent of the current HEAD
149and rebases the current (uncommitted to SVN) work against it.
150
Junio C Hamanoba4b9282008-07-06 05:20:31151This works similarly to `svn update` or 'git-pull' except that
152it preserves linear history with 'git-rebase' instead of
Junio C Hamano610d1762008-11-28 06:27:13153'git-merge' for ease of dcommitting with 'git-svn'.
Junio C Hamano00cb3712007-02-23 11:13:52154
Junio C Hamanoba4b9282008-07-06 05:20:31155This accepts all options that 'git-svn fetch' and 'git-rebase'
Junio C Hamanofce7c7e2008-07-02 03:06:38156accept. However, '--fetch-all' only fetches from the current
Junio C Hamanoa3fd83c2007-03-02 10:34:36157[svn-remote], and not all [svn-remote] definitions.
Junio C Hamano00cb3712007-02-23 11:13:52158
Junio C Hamanoba4b9282008-07-06 05:20:31159Like 'git-rebase'; this requires that the working tree be clean
Junio C Hamanoa3fd83c2007-03-02 10:34:36160and have no uncommitted changes.
Junio C Hamano67fad6d2007-05-06 08:53:12161
Junio C Hamano103ad7f2007-03-14 11:19:26162-l;;
163--local;;
Junio C Hamanoba4b9282008-07-06 05:20:31164Do not fetch remotely; only run 'git-rebase' against the
Junio C Hamano103ad7f2007-03-14 11:19:26165last fetched commit from the upstream SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31166
167'dcommit'::
Junio C Hamano79770b62007-01-07 07:43:58168Commit each diff from a specified head directly to the SVN
Junio C Hamano6b2cee12006-08-26 08:43:31169repository, and then rebase or reset (depending on whether or
Junio C Hamano79770b62007-01-07 07:43:58170not there is a diff between SVN and head). This will create
171a revision in SVN for each commit in git.
Junio C Hamanoba4b9282008-07-06 05:20:31172It is recommended that you run 'git-svn' fetch and rebase (not
Junio C Hamano79770b62007-01-07 07:43:58173pull or merge) your commits against the latest changes in the
174SVN repository.
Junio C Hamano688eae02009-06-28 05:19:50175An optional revision or branch argument may be specified, and
176causes 'git-svn' to do all work on that revision/branch
177instead of HEAD.
Junio C Hamano4bf6dca2006-12-21 02:25:57178This is advantageous over 'set-tree' (below) because it produces
Junio C Hamano6b2cee12006-08-26 08:43:31179cleaner, more linear history.
Junio C Hamano67fad6d2007-05-06 08:53:12180+
181--no-rebase;;
182After committing, do not rebase or reset.
Junio C Hamanofaa1e502008-08-10 03:55:58183--commit-url <URL>;;
184Commit to this SVN URL (the full path). This is intended to
185allow existing git-svn repositories created with one transport
186method (e.g. `svn://` or `http://` for anonymous read) to be
187reused if a user is later given access to an alternate transport
188method (e.g. `svn+ssh://` or `https://`) for commit.
189
Junio C Hamanoa50c35c2009-02-24 07:37:05190config key: svn-remote.<name>.commiturl
191
192config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
193
Junio C Hamanofaa1e502008-08-10 03:55:58194Using this option for any other purpose (don't ask)
195is very strongly discouraged.
Junio C Hamanoa3fd83c2007-03-02 10:34:36196--
Junio C Hamano6b2cee12006-08-26 08:43:31197
Junio C Hamanoa476efa2008-10-10 15:31:42198'branch'::
199Create a branch in the SVN repository.
200
201-m;;
202--message;;
203Allows to specify the commit message.
204
205-t;;
206--tag;;
207Create a tag by using the tags_subdir instead of the branches_subdir
208specified during git svn init.
209
Junio C Hamano688eae02009-06-28 05:19:50210-d;;
211--destination;;
212If more than one --branches (or --tags) option was given to the 'init'
213or 'clone' command, you must provide the location of the branch (or
214tag) you wish to create in the SVN repository. The value of this
215option must match one of the paths specified by a --branches (or
216--tags) option. You can see these paths with the commands
217+
218git config --get-all svn-remote.<name>.branches
219git config --get-all svn-remote.<name>.tags
220+
221where <name> is the name of the SVN repository as specified by the -R option to
222'init' (or "svn" by default).
223
Junio C Hamanoa476efa2008-10-10 15:31:42224'tag'::
225Create a tag in the SVN repository. This is a shorthand for
226'branch -t'.
227
Junio C Hamano43d01342006-10-12 04:07:32228'log'::
229This should make it easy to look up svn log messages when svn
230users refer to -r/--revision numbers.
Junio C Hamanoa3fd83c2007-03-02 10:34:36231+
232The following features from `svn log' are supported:
233+
234--
Junio C Hamano688eae02009-06-28 05:19:50235-r/--revision=<n>[:<n>];;
Junio C Hamanoa3fd83c2007-03-02 10:34:36236is supported, non-numeric args are not:
237HEAD, NEXT, BASE, PREV, etc ...
238-v/--verbose;;
239it's not completely compatible with the --verbose
240output in svn log, but reasonably close.
241--limit=<n>;;
242is NOT the same as --max-count, doesn't count
243merged/excluded commits
244--incremental;;
245supported
246--
247+
248New features:
249+
250--
251--show-commit;;
252shows the git commit sha1, as well
253--oneline;;
254our version of --pretty=oneline
255--
256+
Junio C Hamano24bc09a2008-02-28 00:27:44257NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
258client converts the UTC time to the local time (or based on the TZ=
259environment). This command has the same behaviour.
260+
Junio C Hamanoba4b9282008-07-06 05:20:31261Any other arguments are passed directly to 'git-log'
Junio C Hamano43d01342006-10-12 04:07:32262
Junio C Hamano9c334152008-02-12 03:18:52263'blame'::
Junio C Hamano869bb802008-05-12 00:29:47264 Show what revision and author last modified each line of a file. The
265 output of this mode is format-compatible with the output of
266 `svn blame' by default. Like the SVN blame command,
267 local uncommitted changes in the working copy are ignored;
268 the version of the file in the HEAD revision is annotated. Unknown
Junio C Hamanoba4b9282008-07-06 05:20:31269 arguments are passed directly to 'git-blame'.
Junio C Hamano9c334152008-02-12 03:18:52270+
Junio C Hamano869bb802008-05-12 00:29:47271--git-format;;
Junio C Hamanoba4b9282008-07-06 05:20:31272Produce output in the same format as 'git-blame', but with
Junio C Hamano869bb802008-05-12 00:29:47273SVN revision numbers instead of git commit hashes. In this mode,
274changes that haven't been committed to SVN (including local
275working-copy edits) are shown as revision 0.
Junio C Hamano9c334152008-02-12 03:18:52276
Junio C Hamanoa3fd83c2007-03-02 10:34:36277--
Junio C Hamano469d60e2007-04-29 18:30:34278'find-rev'::
279When given an SVN revision number of the form 'rN', returns the
Junio C Hamanob63afff2007-05-01 03:05:55280corresponding git commit hash (this can optionally be followed by a
281tree-ish to specify which branch should be searched). When given a
282tree-ish, returns the corresponding SVN revision number.
Junio C Hamano469d60e2007-04-29 18:30:34283
Junio C Hamano4bf6dca2006-12-21 02:25:57284'set-tree'::
Junio C Hamano43d01342006-10-12 04:07:32285You should consider using 'dcommit' instead of this command.
Junio C Hamano9ae1a062006-07-10 08:12:34286Commit specified commit or tree objects to SVN. This relies on
287your imported fetch data being up-to-date. This makes
288absolutely no attempts to do patching when committing to SVN, it
289simply overwrites files with those specified in the tree or
290commit. All merging is assumed to have taken place
Junio C Hamanoba4b9282008-07-06 05:20:31291independently of 'git-svn' functions.
Junio C Hamano9ae1a062006-07-10 08:12:34292
Junio C Hamano47d68a52008-05-06 06:35:40293'create-ignore'::
Junio C Hamano47d68a52008-05-06 06:35:40294Recursively finds the svn:ignore property on directories and
295creates matching .gitignore files. The resulting files are staged to
Junio C Hamanofeeb1be2008-05-22 00:53:35296be committed, but are not committed. Use -r/--revision to refer to a
Junio C Hamanocb1c44f2008-08-06 06:19:33297specific revision.
Junio C Hamano47d68a52008-05-06 06:35:40298
Junio C Hamano6b2cee12006-08-26 08:43:31299'show-ignore'::
Junio C Hamano9ae1a062006-07-10 08:12:34300Recursively finds and lists the svn:ignore property on
301directories. The output is suitable for appending to
302the $GIT_DIR/info/exclude file.
303
Junio C Hamano43d01342006-10-12 04:07:32304'commit-diff'::
305Commits the diff of two tree-ish arguments from the
Junio C Hamano7f80ae82008-07-30 18:31:35306command-line. This command does not rely on being inside an `git-svn
Junio C Hamanofce7c7e2008-07-02 03:06:38307init`-ed repository. This command takes three arguments, (a) the
Junio C Hamano43d01342006-10-12 04:07:32308original tree to diff against, (b) the new tree result, (c) the
309URL of the target Subversion repository. The final argument
Junio C Hamanoba4b9282008-07-06 05:20:31310(URL) may be omitted if you are working from a 'git-svn'-aware
311repository (that has been `init`-ed with 'git-svn').
Junio C Hamano23db8852006-11-09 23:35:53312The -r<revision> option is required for this.
Junio C Hamano43d01342006-10-12 04:07:32313
Junio C Hamanoa0970542007-11-23 08:43:30314'info'::
315Shows information about a file or directory similar to what
316`svn info' provides. Does not currently support a -r/--revision
317argument. Use the --url option to output only the value of the
318'URL:' field.
319
Junio C Hamanofeeb1be2008-05-22 00:53:35320'proplist'::
321Lists the properties stored in the Subversion repository about a
322given file or directory. Use -r/--revision to refer to a specific
323Subversion revision.
324
325'propget'::
326Gets the Subversion property given as the first argument, for a
327file. A specific revision can be specified with -r/--revision.
328
329'show-externals'::
330Shows the Subversion externals. Use -r/--revision to specify a
331specific revision.
332
Junio C Hamano688eae02009-06-28 05:19:50333'reset'::
334Undoes the effects of 'fetch' back to the specified revision.
335This allows you to re-'fetch' an SVN revision. Normally the
336contents of an SVN revision should never change and 'reset'
337should not be necessary. However, if SVN permissions change,
338or if you alter your --ignore-paths option, a 'fetch' may fail
339with "not found in commit" (file not previously visible) or
340"checksum mismatch" (missed a modification). If the problem
341file cannot be ignored forever (with --ignore-paths) the only
342way to repair the repo is to use 'reset'.
343
344Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset'
345with a 'fetch' and then 'git-reset' or 'git-rebase' to move local
346branches onto the new tree.
347
348-r/--revision=<n>;;
349Specify the most recent revision to keep. All later revisions
350are discarded.
351-p/--parent;;
352Discard the specified revision as well, keeping the nearest
353parent instead.
354Example:;;
355Assume you have local changes in "master", but you need to refetch "r2".
356
357------------
358 r1---r2---r3 remotes/git-svn
359 \
360 A---B master
361------------
362
363Fix the ignore-paths or SVN permissions problem that caused "r2" to
364be incomplete in the first place. Then:
365
366[verse]
367git svn reset -r2 -p
368git svn fetch
369
370------------
371 r1---r2'--r3' remotes/git-svn
372 \
373 r2---r3---A---B master
374------------
375
376Then fixup "master" with 'git-rebase'.
377Do NOT use 'git-merge' or your history will not be compatible with a
378future 'dcommit'!
379
380[verse]
381git rebase --onto remotes/git-svn A^ master
382
383------------
384 r1---r2'--r3' remotes/git-svn
385 \
386 A'--B' master
387------------
388
389
Junio C Hamano6b2cee12006-08-26 08:43:31390--
391
Junio C Hamano9ae1a062006-07-10 08:12:34392OPTIONS
393-------
Junio C Hamano6b2cee12006-08-26 08:43:31394--
395
Junio C Hamano00cb3712007-02-23 11:13:52396--shared[={false|true|umask|group|all|world|everybody}]::
Junio C Hamano43d01342006-10-12 04:07:32397--template=<template_directory>::
398Only used with the 'init' command.
Junio C Hamanoba4b9282008-07-06 05:20:31399These are passed directly to 'git-init'.
Junio C Hamano43d01342006-10-12 04:07:32400
Junio C Hamano9ae1a062006-07-10 08:12:34401-r <ARG>::
402--revision <ARG>::
Junio C Hamano9ae1a062006-07-10 08:12:34403
Junio C Hamano00cb3712007-02-23 11:13:52404Used with the 'fetch' command.
Junio C Hamano9ae1a062006-07-10 08:12:34405
Junio C Hamano00cb3712007-02-23 11:13:52406This allows revision ranges for partial/cauterized history
407to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
408$NUMBER:HEAD, and BASE:$NUMBER are all supported.
Junio C Hamano6b2cee12006-08-26 08:43:31409
Junio C Hamano00cb3712007-02-23 11:13:52410This can allow you to make partial mirrors when running fetch;
411but is generally not recommended because history will be skipped
412and lost.
Junio C Hamano9ae1a062006-07-10 08:12:34413
414-::
415--stdin::
Junio C Hamano9ae1a062006-07-10 08:12:34416
Junio C Hamano4bf6dca2006-12-21 02:25:57417Only used with the 'set-tree' command.
Junio C Hamano6b2cee12006-08-26 08:43:31418
419Read a list of commits from stdin and commit them in reverse
420order. Only the leading sha1 is read from each line, so
Junio C Hamanoba4b9282008-07-06 05:20:31421'git-rev-list --pretty=oneline' output can be used.
Junio C Hamano9ae1a062006-07-10 08:12:34422
423--rmdir::
Junio C Hamano9ae1a062006-07-10 08:12:34424
Junio C Hamano4bf6dca2006-12-21 02:25:57425Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34426
Junio C Hamano6b2cee12006-08-26 08:43:31427Remove directories from the SVN tree if there are no files left
428behind. SVN can version empty directories, and they are not
429removed by default if there are no files left in them. git
430cannot version empty directories. Enabling this flag will make
431the commit to SVN act like git.
432
Junio C Hamano7ad22dc2007-01-29 02:55:48433config key: svn.rmdir
Junio C Hamano9ae1a062006-07-10 08:12:34434
435-e::
436--edit::
Junio C Hamano9ae1a062006-07-10 08:12:34437
Junio C Hamano4bf6dca2006-12-21 02:25:57438Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34439
Junio C Hamano6b2cee12006-08-26 08:43:31440Edit the commit message before committing to SVN. This is off by
441default for objects that are commits, and forced on when committing
442tree objects.
443
Junio C Hamano7ad22dc2007-01-29 02:55:48444config key: svn.edit
Junio C Hamano9ae1a062006-07-10 08:12:34445
446-l<num>::
447--find-copies-harder::
Junio C Hamano9ae1a062006-07-10 08:12:34448
Junio C Hamano4bf6dca2006-12-21 02:25:57449Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
Junio C Hamano9ae1a062006-07-10 08:12:34450
Junio C Hamanoba4b9282008-07-06 05:20:31451They are both passed directly to 'git-diff-tree'; see
Junio C Hamano35738e82008-01-07 07:55:46452linkgit:git-diff-tree[1] for more information.
Junio C Hamano6b2cee12006-08-26 08:43:31453
454[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48455config key: svn.l
456config key: svn.findcopiesharder
Junio C Hamano9ae1a062006-07-10 08:12:34457
458-A<filename>::
459--authors-file=<filename>::
460
Junio C Hamano7f80ae82008-07-30 18:31:35461Syntax is compatible with the file used by 'git-cvsimport':
Junio C Hamano9ae1a062006-07-10 08:12:34462
463------------------------------------------------------------------------
Junio C Hamano6b2cee12006-08-26 08:43:31464loginname = Joe User <user@example.com>
Junio C Hamano9ae1a062006-07-10 08:12:34465------------------------------------------------------------------------
466
Junio C Hamanoba4b9282008-07-06 05:20:31467If this option is specified and 'git-svn' encounters an SVN
468committer name that does not exist in the authors-file, 'git-svn'
Junio C Hamano6b2cee12006-08-26 08:43:31469will abort operation. The user will then have to add the
Junio C Hamanoba4b9282008-07-06 05:20:31470appropriate entry. Re-running the previous 'git-svn' command
Junio C Hamano6b2cee12006-08-26 08:43:31471after the authors-file is modified should continue operation.
Junio C Hamano9ae1a062006-07-10 08:12:34472
Junio C Hamano7ad22dc2007-01-29 02:55:48473config key: svn.authorsfile
Junio C Hamano43d01342006-10-12 04:07:32474
Junio C Hamano52d5def2009-05-21 16:27:43475--authors-prog=<filename>::
476
477If this option is specified, for each SVN committer name that does not
478exist in the authors file, the given file is executed with the committer
479name as the first argument. The program is expected to return a single
480line of the form "Name <email>", which will be treated as if included in
481the authors file.
482
Junio C Hamano43d01342006-10-12 04:07:32483-q::
484--quiet::
Junio C Hamano9572e922009-04-02 06:52:03485Make 'git-svn' less verbose. Specify a second time to make it
486even less verbose.
Junio C Hamano43d01342006-10-12 04:07:32487
488--repack[=<n>]::
Junio C Hamanoa3fd83c2007-03-02 10:34:36489--repack-flags=<flags>::
Junio C Hamano43d01342006-10-12 04:07:32490
Junio C Hamanoa3fd83c2007-03-02 10:34:36491These should help keep disk usage sane for large fetches
492with many revisions.
Junio C Hamano43d01342006-10-12 04:07:32493
Junio C Hamanoa3fd83c2007-03-02 10:34:36494--repack takes an optional argument for the number of revisions
495to fetch before repacking. This defaults to repacking every
4961000 commits fetched if no argument is specified.
Junio C Hamano43d01342006-10-12 04:07:32497
Junio C Hamanoba4b9282008-07-06 05:20:31498--repack-flags are passed directly to 'git-repack'.
Junio C Hamanoa3fd83c2007-03-02 10:34:36499
500[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48501config key: svn.repack
502config key: svn.repackflags
Junio C Hamano6b2cee12006-08-26 08:43:31503
504-m::
505--merge::
506-s<strategy>::
507--strategy=<strategy>::
508
Junio C Hamano00cb3712007-02-23 11:13:52509These are only used with the 'dcommit' and 'rebase' commands.
Junio C Hamano6b2cee12006-08-26 08:43:31510
Junio C Hamanoba4b9282008-07-06 05:20:31511Passed directly to 'git-rebase' when using 'dcommit' if a
512'git-reset' cannot be used (see 'dcommit').
Junio C Hamano6b2cee12006-08-26 08:43:31513
514-n::
515--dry-run::
516
Junio C Hamanoa476efa2008-10-10 15:31:42517This can be used with the 'dcommit', 'rebase', 'branch' and 'tag'
518commands.
Junio C Hamano6b2cee12006-08-26 08:43:31519
Junio C Hamano9e1793f2008-06-02 07:31:16520For 'dcommit', print out the series of git arguments that would show
Junio C Hamano6b2cee12006-08-26 08:43:31521which diffs would be committed to SVN.
522
Junio C Hamano9e1793f2008-06-02 07:31:16523For 'rebase', display the local branch associated with the upstream svn
524repository associated with the current branch and the URL of svn
525repository that will be fetched from.
526
Junio C Hamanoa476efa2008-10-10 15:31:42527For 'branch' and 'tag', display the urls that will be used for copying when
528creating the branch or tag.
529
Junio C Hamano6b2cee12006-08-26 08:43:31530--
Junio C Hamano9ae1a062006-07-10 08:12:34531
532ADVANCED OPTIONS
533----------------
Junio C Hamano6b2cee12006-08-26 08:43:31534--
535
Junio C Hamano9ae1a062006-07-10 08:12:34536-i<GIT_SVN_ID>::
537--id <GIT_SVN_ID>::
Junio C Hamano6b2cee12006-08-26 08:43:31538
Junio C Hamano00cb3712007-02-23 11:13:52539This sets GIT_SVN_ID (instead of using the environment). This
540allows the user to override the default refname to fetch from
541when tracking a single URL. The 'log' and 'dcommit' commands
542no longer require this switch as an argument.
543
544-R<remote name>::
545--svn-remote <remote name>::
546Specify the [svn-remote "<remote name>"] section to use,
547this allows SVN multiple repositories to be tracked.
548Default: "svn"
Junio C Hamano6b2cee12006-08-26 08:43:31549
Junio C Hamano43d01342006-10-12 04:07:32550--follow-parent::
551This is especially helpful when we're tracking a directory
552that has been moved around within the repository, or if we
553started tracking a branch and never tracked the trunk it was
Junio C Hamano00cb3712007-02-23 11:13:52554descended from. This feature is enabled by default, use
555--no-follow-parent to disable it.
Junio C Hamano43d01342006-10-12 04:07:32556
Junio C Hamano7ad22dc2007-01-29 02:55:48557config key: svn.followparent
Junio C Hamano43d01342006-10-12 04:07:32558
Junio C Hamano00cb3712007-02-23 11:13:52559--
560CONFIG FILE-ONLY OPTIONS
561------------------------
562--
563
564svn.noMetadata::
565svn-remote.<name>.noMetadata::
Junio C Hamano43d01342006-10-12 04:07:32566
Junio C Hamanofce7c7e2008-07-02 03:06:38567This gets rid of the 'git-svn-id:' lines at the end of every commit.
Junio C Hamano43d01342006-10-12 04:07:32568
Junio C Hamanoba4b9282008-07-06 05:20:31569If you lose your .git/svn/git-svn/.rev_db file, 'git-svn' will not
Junio C Hamanoa3fd83c2007-03-02 10:34:36570be able to rebuild it and you won't be able to fetch again,
571either. This is fine for one-shot imports.
572
Junio C Hamanoba4b9282008-07-06 05:20:31573The 'git-svn log' command will not work on repositories using
Junio C Hamanoa3fd83c2007-03-02 10:34:36574this, either. Using this conflicts with the 'useSvmProps'
575option for (hopefully) obvious reasons.
Junio C Hamano43d01342006-10-12 04:07:32576
Junio C Hamano00cb3712007-02-23 11:13:52577svn.useSvmProps::
578svn-remote.<name>.useSvmProps::
Junio C Hamano43d01342006-10-12 04:07:32579
Junio C Hamanoba4b9282008-07-06 05:20:31580This allows 'git-svn' to re-map repository URLs and UUIDs from
Junio C Hamanoa3fd83c2007-03-02 10:34:36581mirrors created using SVN::Mirror (or svk) for metadata.
582
583If an SVN revision has a property, "svm:headrev", it is likely
584that the revision was created by SVN::Mirror (also used by SVK).
585The property contains a repository UUID and a revision. We want
586to make it look like we are mirroring the original URL, so
587introduce a helper function that returns the original identity
588URL and UUID, and use it when generating metadata in commit
589messages.
Junio C Hamano9ae1a062006-07-10 08:12:34590
Junio C Hamano00cb3712007-02-23 11:13:52591svn.useSvnsyncProps::
592svn-remote.<name>.useSvnsyncprops::
593Similar to the useSvmProps option; this is for users
594of the svnsync(1) command distributed with SVN 1.4.x and
595later.
Junio C Hamano9ae1a062006-07-10 08:12:34596
Junio C Hamano00cb3712007-02-23 11:13:52597svn-remote.<name>.rewriteRoot::
598This allows users to create repositories from alternate
Junio C Hamanoba4b9282008-07-06 05:20:31599URLs. For example, an administrator could run 'git-svn' on the
Junio C Hamano00cb3712007-02-23 11:13:52600server locally (accessing via file://) but wish to distribute
601the repository with a public http:// or svn:// URL in the
602metadata so users of it will see the public URL.
Junio C Hamano6b2cee12006-08-26 08:43:31603
Junio C Hamanob3250062009-02-11 20:16:50604svn.brokenSymlinkWorkaround::
605This disables potentially expensive checks to workaround broken symlinks
606checked into SVN by broken clients. Set this option to "false" if you
607track a SVN repository with many empty blobs that are not symlinks.
608This option may be changed while "git-svn" is running and take effect on
609the next revision fetched. If unset, git-svn assumes this option to be
610"true".
611
Junio C Hamano0538b892008-06-20 04:18:33612--
613
Junio C Hamano00cb3712007-02-23 11:13:52614Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
Junio C Hamanoba4b9282008-07-06 05:20:31615options all affect the metadata generated and used by 'git-svn'; they
Junio C Hamano00cb3712007-02-23 11:13:52616*must* be set in the configuration file before any history is imported
617and these settings should never be changed once they are set.
Junio C Hamano9ae1a062006-07-10 08:12:34618
Junio C Hamano00cb3712007-02-23 11:13:52619Additionally, only one of these four options can be used per-svn-remote
620section because they affect the 'git-svn-id:' metadata line.
Junio C Hamano47c1e3c2006-09-25 04:45:55621
Junio C Hamano9ae1a062006-07-10 08:12:34622
Junio C Hamanoa3fd83c2007-03-02 10:34:36623BASIC EXAMPLES
624--------------
Junio C Hamano9ae1a062006-07-10 08:12:34625
Junio C Hamano764a6672007-10-23 01:23:31626Tracking and contributing to the trunk of a Subversion-managed project:
Junio C Hamano9ae1a062006-07-10 08:12:34627
628------------------------------------------------------------------------
Junio C Hamano00cb3712007-02-23 11:13:52629# Clone a repo (like git clone):
Junio C Hamanoa476efa2008-10-10 15:31:42630git svn clone http://svn.example.com/project/trunk
Junio C Hamano00cb3712007-02-23 11:13:52631# Enter the newly cloned directory:
632cd trunk
633# You should be on master branch, double-check with git-branch
634git branch
635# Do some work and commit locally to git:
636git commit ...
637# Something is committed to SVN, rebase your local changes against the
638# latest changes in SVN:
Junio C Hamanofce7c7e2008-07-02 03:06:38639git svn rebase
Junio C Hamano00cb3712007-02-23 11:13:52640# Now commit your changes (that were committed previously using git) to SVN,
641# as well as automatically updating your working HEAD:
Junio C Hamanofce7c7e2008-07-02 03:06:38642git svn dcommit
Junio C Hamano9ae1a062006-07-10 08:12:34643# Append svn:ignore settings to the default git exclude file:
Junio C Hamanofce7c7e2008-07-02 03:06:38644git svn show-ignore >> .git/info/exclude
Junio C Hamano9ae1a062006-07-10 08:12:34645------------------------------------------------------------------------
646
Junio C Hamanoa8d072a2007-01-05 07:46:25647Tracking and contributing to an entire Subversion-managed project
648(complete with a trunk, tags and branches):
Junio C Hamanoa8d072a2007-01-05 07:46:25649
650------------------------------------------------------------------------
Junio C Hamano00cb3712007-02-23 11:13:52651# Clone a repo (like git clone):
Junio C Hamanoa476efa2008-10-10 15:31:42652git svn clone http://svn.example.com/project -T trunk -b branches -t tags
Junio C Hamano00cb3712007-02-23 11:13:52653# View all branches and tags you have cloned:
654git branch -r
Junio C Hamanoa476efa2008-10-10 15:31:42655# Create a new branch in SVN
656 git svn branch waldo
Junio C Hamano00cb3712007-02-23 11:13:52657# Reset your master to trunk (or any other branch, replacing 'trunk'
658# with the appropriate name):
659git reset --hard remotes/trunk
660# You may only dcommit to one branch/tag/trunk at a time. The usage
Junio C Hamanoa3fd83c2007-03-02 10:34:36661# of dcommit/rebase/show-ignore should be the same as above.
Junio C Hamanoa8d072a2007-01-05 07:46:25662------------------------------------------------------------------------
663
Junio C Hamanoba4b9282008-07-06 05:20:31664The initial 'git-svn clone' can be quite time-consuming
Junio C Hamanoe9bfa9b2007-08-07 06:06:11665(especially for large Subversion repositories). If multiple
666people (or one person with multiple machines) want to use
Junio C Hamanoba4b9282008-07-06 05:20:31667'git-svn' to interact with the same Subversion repository, you can
668do the initial 'git-svn clone' to a repository on a server and
669have each person clone that repository with 'git-clone':
Junio C Hamanoe9bfa9b2007-08-07 06:06:11670
671------------------------------------------------------------------------
672# Do the initial import on a server
Junio C Hamanoa476efa2008-10-10 15:31:42673ssh server "cd /pub && git svn clone http://svn.example.com/project
Junio C Hamanof7bb6692008-01-27 08:23:46674# Clone locally - make sure the refs/remotes/ space matches the server
675mkdir project
676cd project
Junio C Hamanofce7c7e2008-07-02 03:06:38677git init
Junio C Hamanof7bb6692008-01-27 08:23:46678git remote add origin server:/pub/project
Junio C Hamano9e7b3f32008-06-29 08:49:03679git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
Junio C Hamanof7bb6692008-01-27 08:23:46680git fetch
Junio C Hamanod3452a02008-11-15 08:07:55681# Create a local branch from one of the branches just fetched
682git checkout -b master FETCH_HEAD
Junio C Hamanoe9bfa9b2007-08-07 06:06:11683# 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:42684git svn init http://svn.example.com/project
Junio C Hamanoe9bfa9b2007-08-07 06:06:11685# Pull the latest changes from Subversion
Junio C Hamanofce7c7e2008-07-02 03:06:38686git svn rebase
Junio C Hamanoe9bfa9b2007-08-07 06:06:11687------------------------------------------------------------------------
688
Junio C Hamano79770b62007-01-07 07:43:58689REBASE VS. PULL/MERGE
690---------------------
Junio C Hamano6b2cee12006-08-26 08:43:31691
Junio C Hamanoba4b9282008-07-06 05:20:31692Originally, 'git-svn' recommended that the 'remotes/git-svn' branch be
Junio C Hamano79770b62007-01-07 07:43:58693pulled or merged from. This is because the author favored
Junio C Hamanofce7c7e2008-07-02 03:06:38694`git svn set-tree B` to commit a single head rather than the
695`git svn set-tree A..B` notation to commit multiple commits.
Junio C Hamano6b2cee12006-08-26 08:43:31696
Junio C Hamanofce7c7e2008-07-02 03:06:38697If you use `git svn set-tree A..B` to commit several diffs and you do
Junio C Hamano79770b62007-01-07 07:43:58698not have the latest remotes/git-svn merged into my-branch, you should
Junio C Hamanofce7c7e2008-07-02 03:06:38699use `git svn rebase` to update your work branch instead of `git pull` or
Junio C Hamano0e88f3e2009-06-21 08:03:25700`git merge`. `pull`/`merge` can cause non-linear history to be flattened
Junio C Hamano79770b62007-01-07 07:43:58701when committing into SVN, which can lead to merge commits reversing
702previous commits in SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31703
Junio C Hamano9ae1a062006-07-10 08:12:34704DESIGN PHILOSOPHY
705-----------------
706Merge tracking in Subversion is lacking and doing branched development
Junio C Hamanoba4b9282008-07-06 05:20:31707with Subversion can be cumbersome as a result. While 'git-svn' can track
Junio C Hamanod2d9ae12007-09-19 02:27:57708copy history (including branches and tags) for repositories adopting a
709standard layout, it cannot yet represent merge history that happened
710inside git back upstream to SVN users. Therefore it is advised that
711users keep history as linear as possible inside git to ease
712compatibility with SVN (see the CAVEATS section below).
Junio C Hamano9ae1a062006-07-10 08:12:34713
Junio C Hamanobdebabb2007-08-23 00:25:09714CAVEATS
715-------
716
717For the sake of simplicity and interoperating with a less-capable system
Junio C Hamanoba4b9282008-07-06 05:20:31718(SVN), it is recommended that all 'git-svn' users clone, fetch and dcommit
719directly from the SVN server, and avoid all 'git-clone'/'pull'/'merge'/'push'
Junio C Hamanobdebabb2007-08-23 00:25:09720operations between git repositories and branches. The recommended
721method of exchanging code between git branches and users is
Junio C Hamanoba4b9282008-07-06 05:20:31722'git-format-patch' and 'git-am', or just 'dcommit'ing to the SVN repository.
Junio C Hamanobdebabb2007-08-23 00:25:09723
Junio C Hamanoba4b9282008-07-06 05:20:31724Running 'git-merge' or 'git-pull' is NOT recommended on a branch you
Junio C Hamanofce7c7e2008-07-02 03:06:38725plan to 'dcommit' from. Subversion does not represent merges in any
Junio C Hamanobdebabb2007-08-23 00:25:09726reasonable or useful fashion; so users using Subversion cannot see any
727merges you've made. Furthermore, if you merge or pull from a git branch
Junio C Hamanofce7c7e2008-07-02 03:06:38728that is a mirror of an SVN branch, 'dcommit' may commit to the wrong
Junio C Hamanobdebabb2007-08-23 00:25:09729branch.
730
Junio C Hamanoba4b9282008-07-06 05:20:31731'git-clone' does not clone branches under the refs/remotes/ hierarchy or
732any 'git-svn' metadata, or config. So repositories created and managed with
733using 'git-svn' should use 'rsync' for cloning, if cloning is to be done
Junio C Hamanobdebabb2007-08-23 00:25:09734at all.
735
Junio C Hamanoba4b9282008-07-06 05:20:31736Since 'dcommit' uses rebase internally, any git branches you 'git-push' to
Junio C Hamanofce7c7e2008-07-02 03:06:38737before 'dcommit' on will require forcing an overwrite of the existing ref
Junio C Hamanobdebabb2007-08-23 00:25:09738on the remote repository. This is generally considered bad practice,
Junio C Hamanofce7c7e2008-07-02 03:06:38739see the linkgit:git-push[1] documentation for details.
Junio C Hamanobdebabb2007-08-23 00:25:09740
Junio C Hamanofce7c7e2008-07-02 03:06:38741Do not use the --amend option of linkgit:git-commit[1] on a change you've
Junio C Hamanobdebabb2007-08-23 00:25:09742already dcommitted. It is considered bad practice to --amend commits
743you've already pushed to a remote repository for other users, and
744dcommit with SVN is analogous to that.
745
Junio C Hamano688eae02009-06-28 05:19:50746When using multiple --branches or --tags, 'git-svn' does not automatically
747handle name collisions (for example, if two branches from different paths have
748the same name, or if a branch and a tag have the same name). In these cases,
749use 'init' to set up your git repository then, before your first 'fetch', edit
750the .git/config file so that the branches and tags are associated with
751different name spaces. For example:
752
753branches = stable/*:refs/remotes/svn/stable/*
754branches = debug/*:refs/remotes/svn/debug/*
755
Junio C Hamano9ae1a062006-07-10 08:12:34756BUGS
757----
Junio C Hamano43d01342006-10-12 04:07:32758
Junio C Hamano00cb3712007-02-23 11:13:52759We ignore all SVN properties except svn:executable. Any unhandled
760properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
Junio C Hamano9ae1a062006-07-10 08:12:34761
Junio C Hamano9ae1a062006-07-10 08:12:34762Renamed and copied directories are not detected by git and hence not
763tracked when committing to SVN. I do not plan on adding support for
764this as it's quite difficult and time-consuming to get working for all
Junio C Hamano00cb3712007-02-23 11:13:52765the possible corner cases (git doesn't do it, either). Committing
766renamed and copied files are fully supported if they're similar enough
767for git to detect them.
768
769CONFIGURATION
770-------------
771
Junio C Hamanoba4b9282008-07-06 05:20:31772'git-svn' stores [svn-remote] configuration information in the
Junio C Hamano00cb3712007-02-23 11:13:52773repository .git/config file. It is similar the core git
774[remote] sections except 'fetch' keys do not accept glob
775arguments; but they are instead handled by the 'branches'
776and 'tags' keys. Since some SVN repositories are oddly
777configured with multiple projects glob expansions such those
778listed below are allowed:
779
780------------------------------------------------------------------------
781[svn-remote "project-a"]
782url = http://server.org/svn
Junio C Hamano9572e922009-04-02 06:52:03783fetch = trunk/project-a:refs/remotes/project-a/trunk
Junio C Hamano00cb3712007-02-23 11:13:52784branches = branches/*/project-a:refs/remotes/project-a/branches/*
785tags = tags/*/project-a:refs/remotes/project-a/tags/*
Junio C Hamano00cb3712007-02-23 11:13:52786------------------------------------------------------------------------
787
Junio C Hamano07738342009-04-23 03:06:56788Keep in mind that the '\*' (asterisk) wildcard of the local ref
Junio C Hamano7d9e9bd2007-08-29 07:31:47789(right of the ':') *must* be the farthest right path component;
Junio C Hamano07738342009-04-23 03:06:56790however the remote wildcard may be anywhere as long as it's an
Junio C Hamanoa6387422007-08-25 03:54:27791independent path component (surrounded by '/' or EOL). This
Junio C Hamano00cb3712007-02-23 11:13:52792type of configuration is not automatically created by 'init' and
Junio C Hamanoba4b9282008-07-06 05:20:31793should be manually entered with a text-editor or using 'git-config'.
Junio C Hamano9ae1a062006-07-10 08:12:34794
Junio C Hamano6b2cee12006-08-26 08:43:31795SEE ALSO
796--------
Junio C Hamano35738e82008-01-07 07:55:46797linkgit:git-rebase[1]
Junio C Hamano6b2cee12006-08-26 08:43:31798
Junio C Hamano9ae1a062006-07-10 08:12:34799Author
800------
801Written by Eric Wong <normalperson@yhbt.net>.
802
803Documentation
804-------------
805Written by Eric Wong <normalperson@yhbt.net>.