blob: aad452f1697b92713a032c36bf40477c51008f04 [file] [log] [blame]
Junio C Hamano9ae1a062006-07-10 08:12:341git-svn(1)
2==========
3
4NAME
5----
Junio C Hamano076ffcc2013-02-06 05:13:216git-svn - Bidirectional operation between a Subversion repository and Git
Junio C Hamano9ae1a062006-07-10 08:12:347
8SYNOPSIS
9--------
Junio C Hamano15567bc2011-07-23 00:51:5910[verse]
Junio C Hamanofce7c7e2008-07-02 03:06:3811'git svn' <command> [options] [arguments]
Junio C Hamano9ae1a062006-07-10 08:12:3412
13DESCRIPTION
14-----------
Junio C Hamano076ffcc2013-02-06 05:13:2115'git svn' is a simple conduit for changesets between Subversion and Git.
16It provides a bidirectional flow of changes between a Subversion and a Git
Junio C Hamanocb1c44f2008-08-06 06:19:3317repository.
Junio C Hamano9ae1a062006-07-10 08:12:3418
Junio C Hamano48bc1ce2009-07-09 16:49:1919'git svn' can track a standard Subversion repository,
Junio C Hamano688eae02009-06-28 05:19:5020following the common "trunk/branches/tags" layout, with the --stdlayout option.
21It can also follow branches and tags in any layout with the -T/-t/-b options
22(see options to 'init' below, and also the 'clone' command).
Junio C Hamano9ae1a062006-07-10 08:12:3423
Junio C Hamano076ffcc2013-02-06 05:13:2124Once tracking a Subversion repository (with any of the above methods), the Git
Junio C Hamano7f80ae82008-07-30 18:31:3525repository can be updated from Subversion by the 'fetch' command and
Junio C Hamano076ffcc2013-02-06 05:13:2126Subversion 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'init'::
Junio C Hamano076ffcc2013-02-06 05:13:2132Initializes an empty Git repository with additional
Junio C Hamano48bc1ce2009-07-09 16:49:1933metadata 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 Hamano657fd8a2010-10-07 00:01:2460This option is not recommended, please read the 'svn.noMetadata'
61section of this manpage before using this option.
Junio C Hamano67fad6d2007-05-06 08:53:1262--use-svm-props;;
Junio C Hamano00cb3712007-02-23 11:13:5263Set the 'useSvmProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1264--use-svnsync-props;;
Junio C Hamano00cb3712007-02-23 11:13:5265Set the 'useSvnsyncProps' option in the [svn-remote] config.
Junio C Hamano67fad6d2007-05-06 08:53:1266--rewrite-root=<URL>;;
Junio C Hamano00cb3712007-02-23 11:13:5267Set the 'rewriteRoot' option in the [svn-remote] config.
Junio C Hamanod0d892c2010-01-24 20:06:2968--rewrite-uuid=<UUID>;;
69Set the 'rewriteUUID' option in the [svn-remote] config.
Junio C Hamano63c2bc92011-02-28 06:41:2870--username=<user>;;
Junio C Hamano00cb3712007-02-23 11:13:5271For transports that SVN handles authentication for (http,
72https, and plain svn), specify the username. For other
73transports (eg svn+ssh://), you must include the username in
74the URL, eg svn+ssh://foo@svn.bar.com/project
Junio C Hamano67fad6d2007-05-06 08:53:1275--prefix=<prefix>;;
Junio C Hamano00cb3712007-02-23 11:13:5276This allows one to specify a prefix which is prepended
77to the names of remotes if trunk/branches/tags are
78specified. The prefix does not automatically include a
79trailing slash, so be sure you include one in the
Junio C Hamano0a2ad892007-06-24 22:23:1280argument if that is what you want. If --branches/-b is
81specified, the prefix must include a trailing slash.
82Setting a prefix is useful if you wish to track multiple
83projects that share a common repository.
Junio C Hamano55344412009-04-12 18:31:1984--ignore-paths=<regex>;;
85When passed to 'init' or 'clone' this regular expression will
86be preserved as a config key. See 'fetch' for a description
87of '--ignore-paths'.
Junio C Hamano3670e392013-05-13 05:11:1888--include-paths=<regex>;;
89When passed to 'init' or 'clone' this regular expression will
90be preserved as a config key. See 'fetch' for a description
91of '--include-paths'.
Junio C Hamanoaa2cd762009-07-26 08:14:0192--no-minimize-url;;
93When tracking multiple directories (using --stdlayout,
94--branches, or --tags options), git svn will attempt to connect
95to the root (or highest allowed level) of the Subversion
96repository. This default allows better tracking of history if
97entire projects are moved within a repository, but may cause
98issues on repositories where read access restrictions are in
99place. Passing '--no-minimize-url' will allow git svn to
100accept URLs as-is without attempting to connect to a higher
101level directory. This option is off by default when only
102one URL/branch is tracked (it would do little good).
Junio C Hamano9ae1a062006-07-10 08:12:34103
Junio C Hamano6b2cee12006-08-26 08:43:31104'fetch'::
Junio C Hamano00cb3712007-02-23 11:13:52105Fetch unfetched revisions from the Subversion remote we are
106tracking. The name of the [svn-remote "..."] section in the
107.git/config file may be specified as an optional command-line
108argument.
Junio C Hamano9ae1a062006-07-10 08:12:34109
Junio C Hamano8f4ac0d2009-01-19 08:35:36110--localtime;;
111Store Git commit times in the local timezone instead of UTC. This
Junio C Hamano48bc1ce2009-07-09 16:49:19112makes 'git log' (even without --date=local) show the same times
Junio C Hamano8f4ac0d2009-01-19 08:35:36113that `svn log` would in the local timezone.
Junio C Hamano48bc1ce2009-07-09 16:49:19114+
Junio C Hamano8f4ac0d2009-01-19 08:35:36115This doesn't interfere with interoperating with the Subversion
116repository you cloned from, but if you wish for your local Git
117repository to be able to interoperate with someone else's local Git
118repository, either don't use this option or you should both use it in
119the same local timezone.
120
Junio C Hamano0df868a2009-08-19 07:28:28121--parent;;
122Fetch only from the SVN parent of the current HEAD.
123
Junio C Hamanoa07e8162009-01-26 17:36:43124--ignore-paths=<regex>;;
Junio C Hamano55344412009-04-12 18:31:19125This allows one to specify a Perl regular expression that will
Junio C Hamanoa07e8162009-01-26 17:36:43126cause skipping of all matching paths from checkout from SVN.
Junio C Hamano55344412009-04-12 18:31:19127The '--ignore-paths' option should match for every 'fetch'
128(including automatic fetches due to 'clone', 'dcommit',
129'rebase', etc) on a given repository.
Junio C Hamano48bc1ce2009-07-09 16:49:19130+
131[verse]
Junio C Hamano55344412009-04-12 18:31:19132config key: svn-remote.<name>.ignore-paths
Junio C Hamano48bc1ce2009-07-09 16:49:19133+
134If the ignore-paths config key is set and the command line option is
135also given, both regular expressions will be used.
136+
Junio C Hamano55344412009-04-12 18:31:19137Examples:
Junio C Hamano48bc1ce2009-07-09 16:49:19138+
139--
140Skip "doc*" directory for every fetch;;
141+
142------------------------------------------------------------------------
143--ignore-paths="^doc"
144------------------------------------------------------------------------
Junio C Hamano55344412009-04-12 18:31:19145
Junio C Hamano48bc1ce2009-07-09 16:49:19146Skip "branches" and "tags" of first level directories;;
147+
148------------------------------------------------------------------------
149--ignore-paths="^[^/]+/(?:branches|tags)"
150------------------------------------------------------------------------
151--
Junio C Hamano55344412009-04-12 18:31:19152
Junio C Hamano3670e392013-05-13 05:11:18153--include-paths=<regex>;;
154This allows one to specify a Perl regular expression that will
155cause the inclusion of only matching paths from checkout from SVN.
156The '--include-paths' option should match for every 'fetch'
157(including automatic fetches due to 'clone', 'dcommit',
158'rebase', etc) on a given repository. '--ignore-paths' takes
159precedence over '--include-paths'.
160
Junio C Hamanoa1295452012-11-13 22:32:04161--log-window-size=<n>;;
162 Fetch <n> log entries per request when scanning Subversion history.
163 The default is 100. For very large Subversion repositories, larger
164 values may be needed for 'clone'/'fetch' to complete in reasonable
165 time. But overly large values may lead to higher memory usage and
166 request timeouts.
167
Junio C Hamano00cb3712007-02-23 11:13:52168'clone'::
169Runs 'init' and 'fetch'. It will automatically create a
170directory based on the basename of the URL passed to it;
171or if a second argument is passed; it will create a directory
172and work within that. It accepts all arguments that the
173'init' and 'fetch' commands accept; with the exception of
Junio C Hamano48bc1ce2009-07-09 16:49:19174'--fetch-all' and '--parent'. After a repository is cloned,
175the 'fetch' command will be able to update revisions without
176affecting the working tree; and the 'rebase' command will be
177able to update the working tree with the latest changes.
Junio C Hamano9ae1a062006-07-10 08:12:34178
Junio C Hamano7bd050f2011-09-22 06:32:22179--preserve-empty-dirs;;
180Create a placeholder file in the local Git repository for each
181empty directory fetched from Subversion. This includes directories
182that become empty by removing all entries in the Subversion
183repository (but not the directory itself). The placeholder files
184are also tracked and removed when no longer necessary.
185
186--placeholder-filename=<filename>;;
187Set the name of placeholder files created by --preserve-empty-dirs.
188Default: ".gitignore"
189
Junio C Hamano00cb3712007-02-23 11:13:52190'rebase'::
191This fetches revisions from the SVN parent of the current HEAD
192and rebases the current (uncommitted to SVN) work against it.
Junio C Hamano48bc1ce2009-07-09 16:49:19193+
194This works similarly to `svn update` or 'git pull' except that
195it preserves linear history with 'git rebase' instead of
196'git merge' for ease of dcommitting with 'git svn'.
197+
198This accepts all options that 'git svn fetch' and 'git rebase'
Junio C Hamanofce7c7e2008-07-02 03:06:38199accept. However, '--fetch-all' only fetches from the current
Junio C Hamanoa3fd83c2007-03-02 10:34:36200[svn-remote], and not all [svn-remote] definitions.
Junio C Hamano48bc1ce2009-07-09 16:49:19201+
202Like 'git rebase'; this requires that the working tree be clean
Junio C Hamanoa3fd83c2007-03-02 10:34:36203and have no uncommitted changes.
Junio C Hamano67fad6d2007-05-06 08:53:12204
Junio C Hamano103ad7f2007-03-14 11:19:26205-l;;
206--local;;
Junio C Hamano48bc1ce2009-07-09 16:49:19207Do not fetch remotely; only run 'git rebase' against the
Junio C Hamano103ad7f2007-03-14 11:19:26208last fetched commit from the upstream SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31209
210'dcommit'::
Junio C Hamanof94fd6c2012-05-17 22:55:14211Commit each diff from the current branch directly to the SVN
Junio C Hamano6b2cee12006-08-26 08:43:31212repository, and then rebase or reset (depending on whether or
Junio C Hamano79770b62007-01-07 07:43:58213not there is a diff between SVN and head). This will create
Junio C Hamano076ffcc2013-02-06 05:13:21214a revision in SVN for each commit in Git.
Junio C Hamanof94fd6c2012-05-17 22:55:14215+
Junio C Hamano076ffcc2013-02-06 05:13:21216When an optional Git branch name (or a Git commit object name)
Junio C Hamanof94fd6c2012-05-17 22:55:14217is specified as an argument, the subcommand works on the specified
218branch, not on the current branch.
219+
220Use of 'dcommit' is preferred to 'set-tree' (below).
Junio C Hamano67fad6d2007-05-06 08:53:12221+
222--no-rebase;;
223After committing, do not rebase or reset.
Junio C Hamanofaa1e502008-08-10 03:55:58224--commit-url <URL>;;
225Commit to this SVN URL (the full path). This is intended to
Junio C Hamano48bc1ce2009-07-09 16:49:19226allow existing 'git svn' repositories created with one transport
Junio C Hamanofaa1e502008-08-10 03:55:58227method (e.g. `svn://` or `http://` for anonymous read) to be
228reused if a user is later given access to an alternate transport
229method (e.g. `svn+ssh://` or `https://`) for commit.
Junio C Hamano48bc1ce2009-07-09 16:49:19230+
231[verse]
Junio C Hamanoa50c35c2009-02-24 07:37:05232config key: svn-remote.<name>.commiturl
Junio C Hamanoa50c35c2009-02-24 07:37:05233config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
Junio C Hamano48bc1ce2009-07-09 16:49:19234+
235Using this option for any other purpose (don't ask) is very strongly
236discouraged.
Junio C Hamano6b2cee12006-08-26 08:43:31237
Junio C Hamano0a901522011-04-19 22:42:05238--mergeinfo=<mergeinfo>;;
239Add the given merge information during the dcommit
240(e.g. `--mergeinfo="/branches/foo:1-10"`). All svn server versions can
241store this information (as a property), and svn clients starting from
Junio C Hamano7bd050f2011-09-22 06:32:22242version 1.5 can make use of it. To specify merge information from multiple
243branches, use a single space character between the branches
244(`--mergeinfo="/branches/foo:1-10 /branches/bar:3,5-6,8"`)
245+
246[verse]
247config key: svn.pushmergeinfo
248+
249This option will cause git-svn to attempt to automatically populate the
250svn:mergeinfo property in the SVN repository when possible. Currently, this can
251only be done when dcommitting non-fast-forward merges where all parents but the
252first have already been pushed into SVN.
Junio C Hamano0a901522011-04-19 22:42:05253
Junio C Hamano483c5782011-10-16 20:42:22254--interactive;;
255Ask the user to confirm that a patch set should actually be sent to SVN.
256For each patch, one may answer "yes" (accept this patch), "no" (discard this
257patch), "all" (accept all patches), or "quit".
258+
259'git svn dcommit' returns immediately if answer if "no" or "quit", without
Junio C Hamanoa080bc32013-04-12 21:33:01260committing anything to SVN.
Junio C Hamano483c5782011-10-16 20:42:22261
Junio C Hamanoa476efa2008-10-10 15:31:42262'branch'::
263Create a branch in the SVN repository.
264
265-m;;
266--message;;
267Allows to specify the commit message.
268
269-t;;
270--tag;;
271Create a tag by using the tags_subdir instead of the branches_subdir
272specified during git svn init.
273
Junio C Hamano48da7832013-05-21 00:14:34274-d<path>;;
275--destination=<path>;;
276
Junio C Hamano688eae02009-06-28 05:19:50277If more than one --branches (or --tags) option was given to the 'init'
278or 'clone' command, you must provide the location of the branch (or
Junio C Hamano48da7832013-05-21 00:14:34279tag) you wish to create in the SVN repository. <path> specifies which
280path to use to create the branch or tag and should match the pattern
281on the left-hand side of one of the configured branches or tags
282refspecs. You can see these refspecs with the commands
Junio C Hamano688eae02009-06-28 05:19:50283+
284git config --get-all svn-remote.<name>.branches
285git config --get-all svn-remote.<name>.tags
286+
287where <name> is the name of the SVN repository as specified by the -R option to
288'init' (or "svn" by default).
289
Junio C Hamanod0d892c2010-01-24 20:06:29290--username;;
291Specify the SVN username to perform the commit as. This option overrides
Junio C Hamano072d22b2010-05-10 02:49:38292the 'username' configuration property.
Junio C Hamanod0d892c2010-01-24 20:06:29293
294--commit-url;;
295Use the specified URL to connect to the destination Subversion
296repository. This is useful in cases where the source SVN
297repository is read-only. This option overrides configuration
298property 'commiturl'.
299+
300git config --get-all svn-remote.<name>.commiturl
301+
302
Junio C Hamano48da7832013-05-21 00:14:34303--parents;;
304Create parent folders. This parameter is equivalent to the parameter
305--parents on svn cp commands and is useful for non-standard repository
306layouts.
307
Junio C Hamanoa476efa2008-10-10 15:31:42308'tag'::
309Create a tag in the SVN repository. This is a shorthand for
310'branch -t'.
311
Junio C Hamano43d01342006-10-12 04:07:32312'log'::
313This should make it easy to look up svn log messages when svn
314users refer to -r/--revision numbers.
Junio C Hamanoa3fd83c2007-03-02 10:34:36315+
316The following features from `svn log' are supported:
317+
318--
Junio C Hamano48bc1ce2009-07-09 16:49:19319-r <n>[:<n>];;
320--revision=<n>[:<n>];;
Junio C Hamanoa3fd83c2007-03-02 10:34:36321is supported, non-numeric args are not:
322HEAD, NEXT, BASE, PREV, etc ...
Junio C Hamano48bc1ce2009-07-09 16:49:19323-v;;
324--verbose;;
Junio C Hamanoa3fd83c2007-03-02 10:34:36325it's not completely compatible with the --verbose
326output in svn log, but reasonably close.
327--limit=<n>;;
328is NOT the same as --max-count, doesn't count
329merged/excluded commits
330--incremental;;
331supported
332--
333+
334New features:
335+
336--
337--show-commit;;
Junio C Hamano076ffcc2013-02-06 05:13:21338shows the Git commit sha1, as well
Junio C Hamanoa3fd83c2007-03-02 10:34:36339--oneline;;
340our version of --pretty=oneline
341--
342+
Junio C Hamano24bc09a2008-02-28 00:27:44343NOTE: SVN itself only stores times in UTC and nothing else. The regular svn
344client converts the UTC time to the local time (or based on the TZ=
345environment). This command has the same behaviour.
346+
Junio C Hamano48bc1ce2009-07-09 16:49:19347Any other arguments are passed directly to 'git log'
Junio C Hamano43d01342006-10-12 04:07:32348
Junio C Hamano9c334152008-02-12 03:18:52349'blame'::
Junio C Hamano869bb802008-05-12 00:29:47350 Show what revision and author last modified each line of a file. The
351 output of this mode is format-compatible with the output of
352 `svn blame' by default. Like the SVN blame command,
Junio C Hamano8fb66e52011-10-05 20:59:51353 local uncommitted changes in the working tree are ignored;
Junio C Hamano869bb802008-05-12 00:29:47354 the version of the file in the HEAD revision is annotated. Unknown
Junio C Hamano48bc1ce2009-07-09 16:49:19355 arguments are passed directly to 'git blame'.
Junio C Hamano9c334152008-02-12 03:18:52356+
Junio C Hamano869bb802008-05-12 00:29:47357--git-format;;
Junio C Hamano48bc1ce2009-07-09 16:49:19358Produce output in the same format as 'git blame', but with
Junio C Hamano076ffcc2013-02-06 05:13:21359SVN revision numbers instead of Git commit hashes. In this mode,
Junio C Hamano869bb802008-05-12 00:29:47360changes that haven't been committed to SVN (including local
361working-copy edits) are shown as revision 0.
Junio C Hamano9c334152008-02-12 03:18:52362
Junio C Hamano469d60e2007-04-29 18:30:34363'find-rev'::
364When given an SVN revision number of the form 'rN', returns the
Junio C Hamano076ffcc2013-02-06 05:13:21365corresponding Git commit hash (this can optionally be followed by a
Junio C Hamanob63afff2007-05-01 03:05:55366tree-ish to specify which branch should be searched). When given a
367tree-ish, returns the corresponding SVN revision number.
Junio C Hamano5dd5fae2013-01-18 21:06:49368+
369--before;;
370Don't require an exact match if given an SVN revision, instead find
371the commit corresponding to the state of the SVN repository (on the
372current branch) at the specified revision.
373+
374--after;;
375Don't require an exact match if given an SVN revision; if there is
376not an exact match return the closest match searching forward in the
377history.
Junio C Hamano469d60e2007-04-29 18:30:34378
Junio C Hamano4bf6dca2006-12-21 02:25:57379'set-tree'::
Junio C Hamano43d01342006-10-12 04:07:32380You should consider using 'dcommit' instead of this command.
Junio C Hamano9ae1a062006-07-10 08:12:34381Commit specified commit or tree objects to SVN. This relies on
382your imported fetch data being up-to-date. This makes
383absolutely no attempts to do patching when committing to SVN, it
384simply overwrites files with those specified in the tree or
385commit. All merging is assumed to have taken place
Junio C Hamano48bc1ce2009-07-09 16:49:19386independently of 'git svn' functions.
Junio C Hamano9ae1a062006-07-10 08:12:34387
Junio C Hamano47d68a52008-05-06 06:35:40388'create-ignore'::
Junio C Hamano47d68a52008-05-06 06:35:40389Recursively finds the svn:ignore property on directories and
390creates matching .gitignore files. The resulting files are staged to
Junio C Hamanofeeb1be2008-05-22 00:53:35391be committed, but are not committed. Use -r/--revision to refer to a
Junio C Hamanocb1c44f2008-08-06 06:19:33392specific revision.
Junio C Hamano47d68a52008-05-06 06:35:40393
Junio C Hamano6b2cee12006-08-26 08:43:31394'show-ignore'::
Junio C Hamano9ae1a062006-07-10 08:12:34395Recursively finds and lists the svn:ignore property on
396directories. The output is suitable for appending to
397the $GIT_DIR/info/exclude file.
398
Junio C Hamanoa5574462009-11-18 07:39:28399'mkdirs'::
Junio C Hamano076ffcc2013-02-06 05:13:21400Attempts to recreate empty directories that core Git cannot track
Junio C Hamanoa5574462009-11-18 07:39:28401based on information in $GIT_DIR/svn/<refname>/unhandled.log files.
402Empty directories are automatically recreated when using
403"git svn clone" and "git svn rebase", so "mkdirs" is intended
404for use after commands like "git checkout" or "git reset".
Junio C Hamano209ebe82011-04-27 21:09:59405(See the svn-remote.<name>.automkdirs config file option for
406more information.)
Junio C Hamanoa5574462009-11-18 07:39:28407
Junio C Hamano43d01342006-10-12 04:07:32408'commit-diff'::
409Commits the diff of two tree-ish arguments from the
Junio C Hamano48bc1ce2009-07-09 16:49:19410command-line. This command does not rely on being inside an `git svn
Junio C Hamanofce7c7e2008-07-02 03:06:38411init`-ed repository. This command takes three arguments, (a) the
Junio C Hamano43d01342006-10-12 04:07:32412original tree to diff against, (b) the new tree result, (c) the
413URL of the target Subversion repository. The final argument
Junio C Hamano48bc1ce2009-07-09 16:49:19414(URL) may be omitted if you are working from a 'git svn'-aware
415repository (that has been `init`-ed with 'git svn').
Junio C Hamano23db8852006-11-09 23:35:53416The -r<revision> option is required for this.
Junio C Hamano43d01342006-10-12 04:07:32417
Junio C Hamanoa0970542007-11-23 08:43:30418'info'::
419Shows information about a file or directory similar to what
420`svn info' provides. Does not currently support a -r/--revision
421argument. Use the --url option to output only the value of the
422'URL:' field.
423
Junio C Hamanofeeb1be2008-05-22 00:53:35424'proplist'::
425Lists the properties stored in the Subversion repository about a
426given file or directory. Use -r/--revision to refer to a specific
427Subversion revision.
428
429'propget'::
430Gets the Subversion property given as the first argument, for a
431file. A specific revision can be specified with -r/--revision.
432
433'show-externals'::
434Shows the Subversion externals. Use -r/--revision to specify a
435specific revision.
436
Junio C Hamanoaa2cd762009-07-26 08:14:01437'gc'::
438Compress $GIT_DIR/svn/<refname>/unhandled.log files in .git/svn
439and remove $GIT_DIR/svn/<refname>index files in .git/svn.
440
Junio C Hamano688eae02009-06-28 05:19:50441'reset'::
442Undoes the effects of 'fetch' back to the specified revision.
443This allows you to re-'fetch' an SVN revision. Normally the
444contents of an SVN revision should never change and 'reset'
445should not be necessary. However, if SVN permissions change,
446or if you alter your --ignore-paths option, a 'fetch' may fail
447with "not found in commit" (file not previously visible) or
448"checksum mismatch" (missed a modification). If the problem
449file cannot be ignored forever (with --ignore-paths) the only
450way to repair the repo is to use 'reset'.
Junio C Hamano48bc1ce2009-07-09 16:49:19451+
Junio C Hamano688eae02009-06-28 05:19:50452Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset'
Junio C Hamano48bc1ce2009-07-09 16:49:19453with a 'fetch' and then 'git reset' or 'git rebase' to move local
Junio C Hamano688eae02009-06-28 05:19:50454branches onto the new tree.
455
Junio C Hamano48bc1ce2009-07-09 16:49:19456-r <n>;;
457--revision=<n>;;
Junio C Hamano688eae02009-06-28 05:19:50458Specify the most recent revision to keep. All later revisions
459are discarded.
Junio C Hamano48bc1ce2009-07-09 16:49:19460-p;;
461--parent;;
Junio C Hamano688eae02009-06-28 05:19:50462Discard the specified revision as well, keeping the nearest
463parent instead.
464Example:;;
465Assume you have local changes in "master", but you need to refetch "r2".
Junio C Hamano48bc1ce2009-07-09 16:49:19466+
Junio C Hamano688eae02009-06-28 05:19:50467------------
468 r1---r2---r3 remotes/git-svn
469 \
470 A---B master
471------------
Junio C Hamano48bc1ce2009-07-09 16:49:19472+
Junio C Hamano688eae02009-06-28 05:19:50473Fix the ignore-paths or SVN permissions problem that caused "r2" to
474be incomplete in the first place. Then:
Junio C Hamano48bc1ce2009-07-09 16:49:19475+
Junio C Hamano688eae02009-06-28 05:19:50476[verse]
477git svn reset -r2 -p
478git svn fetch
Junio C Hamano48bc1ce2009-07-09 16:49:19479+
Junio C Hamano688eae02009-06-28 05:19:50480------------
481 r1---r2'--r3' remotes/git-svn
482 \
483 r2---r3---A---B master
484------------
Junio C Hamano48bc1ce2009-07-09 16:49:19485+
486Then fixup "master" with 'git rebase'.
487Do NOT use 'git merge' or your history will not be compatible with a
Junio C Hamano688eae02009-06-28 05:19:50488future 'dcommit'!
Junio C Hamano48bc1ce2009-07-09 16:49:19489+
Junio C Hamano688eae02009-06-28 05:19:50490[verse]
491git rebase --onto remotes/git-svn A^ master
Junio C Hamano48bc1ce2009-07-09 16:49:19492+
Junio C Hamano688eae02009-06-28 05:19:50493------------
494 r1---r2'--r3' remotes/git-svn
495 \
496 A'--B' master
497------------
498
Junio C Hamano9ae1a062006-07-10 08:12:34499OPTIONS
500-------
Junio C Hamano6b2cee12006-08-26 08:43:31501
Junio C Hamanod2179ef2010-10-22 04:12:17502--shared[=(false|true|umask|group|all|world|everybody)]::
Junio C Hamano43d01342006-10-12 04:07:32503--template=<template_directory>::
504Only used with the 'init' command.
Junio C Hamano48bc1ce2009-07-09 16:49:19505These are passed directly to 'git init'.
Junio C Hamano43d01342006-10-12 04:07:32506
Junio C Hamano63c2bc92011-02-28 06:41:28507-r <arg>::
508--revision <arg>::
Junio C Hamano48bc1ce2009-07-09 16:49:19509 Used with the 'fetch' command.
510+
Junio C Hamano00cb3712007-02-23 11:13:52511This allows revision ranges for partial/cauterized history
512to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
513$NUMBER:HEAD, and BASE:$NUMBER are all supported.
Junio C Hamano48bc1ce2009-07-09 16:49:19514+
Junio C Hamano00cb3712007-02-23 11:13:52515This can allow you to make partial mirrors when running fetch;
516but is generally not recommended because history will be skipped
517and lost.
Junio C Hamano9ae1a062006-07-10 08:12:34518
519-::
520--stdin::
Junio C Hamano48bc1ce2009-07-09 16:49:19521Only used with the 'set-tree' command.
522+
Junio C Hamano6b2cee12006-08-26 08:43:31523Read a list of commits from stdin and commit them in reverse
524order. Only the leading sha1 is read from each line, so
Junio C Hamano48bc1ce2009-07-09 16:49:19525'git rev-list --pretty=oneline' output can be used.
Junio C Hamano9ae1a062006-07-10 08:12:34526
527--rmdir::
Junio C Hamano48bc1ce2009-07-09 16:49:19528Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
529+
Junio C Hamano6b2cee12006-08-26 08:43:31530Remove directories from the SVN tree if there are no files left
531behind. SVN can version empty directories, and they are not
Junio C Hamano076ffcc2013-02-06 05:13:21532removed by default if there are no files left in them. Git
Junio C Hamano6b2cee12006-08-26 08:43:31533cannot version empty directories. Enabling this flag will make
Junio C Hamano076ffcc2013-02-06 05:13:21534the commit to SVN act like Git.
Junio C Hamano48bc1ce2009-07-09 16:49:19535+
536[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48537config key: svn.rmdir
Junio C Hamano9ae1a062006-07-10 08:12:34538
539-e::
540--edit::
Junio C Hamano48bc1ce2009-07-09 16:49:19541Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
542+
Junio C Hamano6b2cee12006-08-26 08:43:31543Edit the commit message before committing to SVN. This is off by
544default for objects that are commits, and forced on when committing
545tree objects.
Junio C Hamano48bc1ce2009-07-09 16:49:19546+
547[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48548config key: svn.edit
Junio C Hamano9ae1a062006-07-10 08:12:34549
550-l<num>::
551--find-copies-harder::
Junio C Hamano48bc1ce2009-07-09 16:49:19552Only used with the 'dcommit', 'set-tree' and 'commit-diff' commands.
553+
554They are both passed directly to 'git diff-tree'; see
Junio C Hamano35738e82008-01-07 07:55:46555linkgit:git-diff-tree[1] for more information.
Junio C Hamano48bc1ce2009-07-09 16:49:19556+
Junio C Hamano6b2cee12006-08-26 08:43:31557[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48558config key: svn.l
559config key: svn.findcopiesharder
Junio C Hamano9ae1a062006-07-10 08:12:34560
561-A<filename>::
562--authors-file=<filename>::
Junio C Hamano48bc1ce2009-07-09 16:49:19563Syntax is compatible with the file used by 'git cvsimport':
564+
Junio C Hamano9ae1a062006-07-10 08:12:34565------------------------------------------------------------------------
Junio C Hamano6b2cee12006-08-26 08:43:31566loginname = Joe User <user@example.com>
Junio C Hamano9ae1a062006-07-10 08:12:34567------------------------------------------------------------------------
Junio C Hamano48bc1ce2009-07-09 16:49:19568+
569If this option is specified and 'git svn' encounters an SVN
570committer name that does not exist in the authors-file, 'git svn'
Junio C Hamano6b2cee12006-08-26 08:43:31571will abort operation. The user will then have to add the
Junio C Hamano48bc1ce2009-07-09 16:49:19572appropriate entry. Re-running the previous 'git svn' command
Junio C Hamano6b2cee12006-08-26 08:43:31573after the authors-file is modified should continue operation.
Junio C Hamano48bc1ce2009-07-09 16:49:19574+
575[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48576config key: svn.authorsfile
Junio C Hamano43d01342006-10-12 04:07:32577
Junio C Hamano52d5def2009-05-21 16:27:43578--authors-prog=<filename>::
Junio C Hamano48bc1ce2009-07-09 16:49:19579If this option is specified, for each SVN committer name that
580does not exist in the authors file, the given file is executed
581with the committer name as the first argument. The program is
582expected to return a single line of the form "Name <email>",
583which will be treated as if included in the authors file.
Junio C Hamano52d5def2009-05-21 16:27:43584
Junio C Hamano43d01342006-10-12 04:07:32585-q::
586--quiet::
Junio C Hamano48bc1ce2009-07-09 16:49:19587Make 'git svn' less verbose. Specify a second time to make it
Junio C Hamano9572e922009-04-02 06:52:03588even less verbose.
Junio C Hamano43d01342006-10-12 04:07:32589
590--repack[=<n>]::
Junio C Hamanoa3fd83c2007-03-02 10:34:36591--repack-flags=<flags>::
Junio C Hamano48bc1ce2009-07-09 16:49:19592These should help keep disk usage sane for large fetches with
593many revisions.
594+
Junio C Hamanoa3fd83c2007-03-02 10:34:36595--repack takes an optional argument for the number of revisions
596to fetch before repacking. This defaults to repacking every
5971000 commits fetched if no argument is specified.
Junio C Hamano48bc1ce2009-07-09 16:49:19598+
599--repack-flags are passed directly to 'git repack'.
600+
Junio C Hamanoa3fd83c2007-03-02 10:34:36601[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48602config key: svn.repack
603config key: svn.repackflags
Junio C Hamano6b2cee12006-08-26 08:43:31604
605-m::
606--merge::
607-s<strategy>::
608--strategy=<strategy>::
Junio C Hamanof94fd6c2012-05-17 22:55:14609-p::
610--preserve-merges::
Junio C Hamano48bc1ce2009-07-09 16:49:19611These are only used with the 'dcommit' and 'rebase' commands.
612+
613Passed directly to 'git rebase' when using 'dcommit' if a
614'git reset' cannot be used (see 'dcommit').
Junio C Hamano6b2cee12006-08-26 08:43:31615
616-n::
617--dry-run::
Junio C Hamano48bc1ce2009-07-09 16:49:19618This can be used with the 'dcommit', 'rebase', 'branch' and
619'tag' commands.
620+
Junio C Hamano076ffcc2013-02-06 05:13:21621For 'dcommit', print out the series of Git arguments that would show
Junio C Hamano6b2cee12006-08-26 08:43:31622which diffs would be committed to SVN.
Junio C Hamano48bc1ce2009-07-09 16:49:19623+
Junio C Hamano9e1793f2008-06-02 07:31:16624For 'rebase', display the local branch associated with the upstream svn
625repository associated with the current branch and the URL of svn
626repository that will be fetched from.
Junio C Hamano48bc1ce2009-07-09 16:49:19627+
Junio C Hamanoa476efa2008-10-10 15:31:42628For 'branch' and 'tag', display the urls that will be used for copying when
629creating the branch or tag.
630
Junio C Hamano4f018922011-05-01 23:54:06631--use-log-author::
Junio C Hamano076ffcc2013-02-06 05:13:21632When retrieving svn commits into Git (as part of 'fetch', 'rebase', or
Junio C Hamano4f018922011-05-01 23:54:06633'dcommit' operations), look for the first `From:` or `Signed-off-by:` line
634in the log message and use that as the author string.
635--add-author-from::
Junio C Hamano076ffcc2013-02-06 05:13:21636When committing to svn from Git (as part of 'commit-diff', 'set-tree' or 'dcommit'
Junio C Hamano4f018922011-05-01 23:54:06637operations), if the existing log message doesn't already have a
638`From:` or `Signed-off-by:` line, append a `From:` line based on the
Junio C Hamano076ffcc2013-02-06 05:13:21639Git commit's author string. If you use this, then `--use-log-author`
Junio C Hamano4f018922011-05-01 23:54:06640will retrieve a valid author string for all commits.
641
Junio C Hamano9ae1a062006-07-10 08:12:34642
643ADVANCED OPTIONS
644----------------
Junio C Hamano6b2cee12006-08-26 08:43:31645
Junio C Hamano9ae1a062006-07-10 08:12:34646-i<GIT_SVN_ID>::
647--id <GIT_SVN_ID>::
Junio C Hamano48bc1ce2009-07-09 16:49:19648This sets GIT_SVN_ID (instead of using the environment). This
649allows the user to override the default refname to fetch from
650when tracking a single URL. The 'log' and 'dcommit' commands
651no longer require this switch as an argument.
Junio C Hamano00cb3712007-02-23 11:13:52652
653-R<remote name>::
654--svn-remote <remote name>::
655Specify the [svn-remote "<remote name>"] section to use,
656this allows SVN multiple repositories to be tracked.
657Default: "svn"
Junio C Hamano6b2cee12006-08-26 08:43:31658
Junio C Hamano43d01342006-10-12 04:07:32659--follow-parent::
Junio C Hamanodb81b992012-12-21 23:49:12660This option is only relevant if we are tracking branches (using
661one of the repository layout options --trunk, --tags,
662--branches, --stdlayout). For each tracked branch, try to find
663out where its revision was copied from, and set
Junio C Hamano076ffcc2013-02-06 05:13:21664a suitable parent in the first Git commit for the branch.
Junio C Hamano43d01342006-10-12 04:07:32665This is especially helpful when we're tracking a directory
Junio C Hamanodb81b992012-12-21 23:49:12666that has been moved around within the repository. If this
667feature is disabled, the branches created by 'git svn' will all
668be linear and not share any history, meaning that there will be
669no information on where branches were branched off or merged.
670However, following long/convoluted histories can take a long
671time, so disabling this feature may speed up the cloning
672process. This feature is enabled by default, use
Junio C Hamano00cb3712007-02-23 11:13:52673--no-follow-parent to disable it.
Junio C Hamano48bc1ce2009-07-09 16:49:19674+
675[verse]
Junio C Hamano7ad22dc2007-01-29 02:55:48676config key: svn.followparent
Junio C Hamano43d01342006-10-12 04:07:32677
Junio C Hamano00cb3712007-02-23 11:13:52678CONFIG FILE-ONLY OPTIONS
679------------------------
Junio C Hamano00cb3712007-02-23 11:13:52680
681svn.noMetadata::
682svn-remote.<name>.noMetadata::
Junio C Hamano48bc1ce2009-07-09 16:49:19683This gets rid of the 'git-svn-id:' lines at the end of every commit.
684+
Junio C Hamano657fd8a2010-10-07 00:01:24685This option can only be used for one-shot imports as 'git svn'
686will not be able to fetch again without metadata. Additionally,
687if you lose your .git/svn/**/.rev_map.* files, 'git svn' will not
688be able to rebuild them.
Junio C Hamano48bc1ce2009-07-09 16:49:19689+
690The 'git svn log' command will not work on repositories using
Junio C Hamanoa3fd83c2007-03-02 10:34:36691this, either. Using this conflicts with the 'useSvmProps'
692option for (hopefully) obvious reasons.
Junio C Hamano657fd8a2010-10-07 00:01:24693+
694This option is NOT recommended as it makes it difficult to track down
695old references to SVN revision numbers in existing documentation, bug
Junio C Hamano076ffcc2013-02-06 05:13:21696reports and archives. If you plan to eventually migrate from SVN to Git
Junio C Hamano657fd8a2010-10-07 00:01:24697and are certain about dropping SVN history, consider
698linkgit:git-filter-branch[1] instead. filter-branch also allows
Junio C Hamano7165bf72011-01-04 22:06:18699reformatting of metadata for ease-of-reading and rewriting authorship
Junio C Hamano657fd8a2010-10-07 00:01:24700info for non-"svn.authorsFile" users.
Junio C Hamano43d01342006-10-12 04:07:32701
Junio C Hamano00cb3712007-02-23 11:13:52702svn.useSvmProps::
703svn-remote.<name>.useSvmProps::
Junio C Hamano48bc1ce2009-07-09 16:49:19704This allows 'git svn' to re-map repository URLs and UUIDs from
705mirrors created using SVN::Mirror (or svk) for metadata.
706+
Junio C Hamanoa3fd83c2007-03-02 10:34:36707If an SVN revision has a property, "svm:headrev", it is likely
708that the revision was created by SVN::Mirror (also used by SVK).
709The property contains a repository UUID and a revision. We want
710to make it look like we are mirroring the original URL, so
711introduce a helper function that returns the original identity
712URL and UUID, and use it when generating metadata in commit
713messages.
Junio C Hamano9ae1a062006-07-10 08:12:34714
Junio C Hamano00cb3712007-02-23 11:13:52715svn.useSvnsyncProps::
716svn-remote.<name>.useSvnsyncprops::
717Similar to the useSvmProps option; this is for users
718of the svnsync(1) command distributed with SVN 1.4.x and
719later.
Junio C Hamano9ae1a062006-07-10 08:12:34720
Junio C Hamano00cb3712007-02-23 11:13:52721svn-remote.<name>.rewriteRoot::
722This allows users to create repositories from alternate
Junio C Hamano48bc1ce2009-07-09 16:49:19723URLs. For example, an administrator could run 'git svn' on the
Junio C Hamano00cb3712007-02-23 11:13:52724server locally (accessing via file://) but wish to distribute
725the repository with a public http:// or svn:// URL in the
726metadata so users of it will see the public URL.
Junio C Hamano6b2cee12006-08-26 08:43:31727
Junio C Hamanod0d892c2010-01-24 20:06:29728svn-remote.<name>.rewriteUUID::
729Similar to the useSvmProps option; this is for users who need
730to remap the UUID manually. This may be useful in situations
731where the original UUID is not available via either useSvmProps
732or useSvnsyncProps.
733
Junio C Hamanof7e049c2011-04-11 23:48:36734svn-remote.<name>.pushurl::
735
Junio C Hamano076ffcc2013-02-06 05:13:21736Similar to Git's 'remote.<name>.pushurl', this key is designed
Junio C Hamanof7e049c2011-04-11 23:48:36737to be used in cases where 'url' points to an SVN repository
738via a read-only transport, to provide an alternate read/write
739transport. It is assumed that both keys point to the same
740repository. Unlike 'commiturl', 'pushurl' is a base path. If
741either 'commiturl' or 'pushurl' could be used, 'commiturl'
742takes precedence.
743
Junio C Hamanob3250062009-02-11 20:16:50744svn.brokenSymlinkWorkaround::
Junio C Hamano48bc1ce2009-07-09 16:49:19745This disables potentially expensive checks to workaround
746broken symlinks checked into SVN by broken clients. Set this
747option to "false" if you track a SVN repository with many
748empty blobs that are not symlinks. This option may be changed
749while 'git svn' is running and take effect on the next
750revision fetched. If unset, 'git svn' assumes this option to
751be "true".
Junio C Hamano0538b892008-06-20 04:18:33752
Junio C Hamanoa9788762010-08-03 15:15:54753svn.pathnameencoding::
754This instructs git svn to recode pathnames to a given encoding.
755It can be used by windows users and by those who work in non-utf8
756locales to avoid corrupted file names with non-ASCII characters.
757Valid encodings are the ones supported by Perl's Encode module.
758
Junio C Hamano209ebe82011-04-27 21:09:59759svn-remote.<name>.automkdirs::
760Normally, the "git svn clone" and "git svn rebase" commands
761attempt to recreate empty directories that are in the
762Subversion repository. If this option is set to "false", then
763empty directories will only be created if the "git svn mkdirs"
764command is run explicitly. If unset, 'git svn' assumes this
765option to be "true".
766
Junio C Hamanod0d892c2010-01-24 20:06:29767Since the noMetadata, rewriteRoot, rewriteUUID, useSvnsyncProps and useSvmProps
Junio C Hamano48bc1ce2009-07-09 16:49:19768options all affect the metadata generated and used by 'git svn'; they
Junio C Hamano00cb3712007-02-23 11:13:52769*must* be set in the configuration file before any history is imported
770and these settings should never be changed once they are set.
Junio C Hamano9ae1a062006-07-10 08:12:34771
Junio C Hamanod0d892c2010-01-24 20:06:29772Additionally, only one of these options can be used per svn-remote
773section because they affect the 'git-svn-id:' metadata line, except
774for rewriteRoot and rewriteUUID which can be used together.
Junio C Hamano47c1e3c2006-09-25 04:45:55775
Junio C Hamano9ae1a062006-07-10 08:12:34776
Junio C Hamanoa3fd83c2007-03-02 10:34:36777BASIC EXAMPLES
778--------------
Junio C Hamano9ae1a062006-07-10 08:12:34779
Junio C Hamanodb81b992012-12-21 23:49:12780Tracking and contributing to the trunk of a Subversion-managed project
781(ignoring tags and branches):
Junio C Hamano9ae1a062006-07-10 08:12:34782
783------------------------------------------------------------------------
Junio C Hamano00cb3712007-02-23 11:13:52784# Clone a repo (like git clone):
Junio C Hamanoa476efa2008-10-10 15:31:42785git svn clone http://svn.example.com/project/trunk
Junio C Hamano00cb3712007-02-23 11:13:52786# Enter the newly cloned directory:
787cd trunk
Junio C Hamano48bc1ce2009-07-09 16:49:19788# You should be on master branch, double-check with 'git branch'
Junio C Hamano00cb3712007-02-23 11:13:52789git branch
Junio C Hamano076ffcc2013-02-06 05:13:21790# Do some work and commit locally to Git:
Junio C Hamano00cb3712007-02-23 11:13:52791git commit ...
792# Something is committed to SVN, rebase your local changes against the
793# latest changes in SVN:
Junio C Hamanofce7c7e2008-07-02 03:06:38794git svn rebase
Junio C Hamano076ffcc2013-02-06 05:13:21795# Now commit your changes (that were committed previously using Git) to SVN,
Junio C Hamano00cb3712007-02-23 11:13:52796# as well as automatically updating your working HEAD:
Junio C Hamanofce7c7e2008-07-02 03:06:38797git svn dcommit
Junio C Hamano076ffcc2013-02-06 05:13:21798# Append svn:ignore settings to the default Git exclude file:
Junio C Hamanofce7c7e2008-07-02 03:06:38799git svn show-ignore >> .git/info/exclude
Junio C Hamano9ae1a062006-07-10 08:12:34800------------------------------------------------------------------------
801
Junio C Hamanoa8d072a2007-01-05 07:46:25802Tracking and contributing to an entire Subversion-managed project
803(complete with a trunk, tags and branches):
Junio C Hamanoa8d072a2007-01-05 07:46:25804
805------------------------------------------------------------------------
Junio C Hamanodb81b992012-12-21 23:49:12806# Clone a repo with standard SVN directory layout (like git clone):
807git svn clone http://svn.example.com/project --stdlayout
808# Or, if the repo uses a non-standard directory layout:
809git svn clone http://svn.example.com/project -T tr -b branch -t tag
Junio C Hamano00cb3712007-02-23 11:13:52810# View all branches and tags you have cloned:
811git branch -r
Junio C Hamanoa476efa2008-10-10 15:31:42812# Create a new branch in SVN
813 git svn branch waldo
Junio C Hamano00cb3712007-02-23 11:13:52814# Reset your master to trunk (or any other branch, replacing 'trunk'
815# with the appropriate name):
816git reset --hard remotes/trunk
817# You may only dcommit to one branch/tag/trunk at a time. The usage
Junio C Hamanoa3fd83c2007-03-02 10:34:36818# of dcommit/rebase/show-ignore should be the same as above.
Junio C Hamanoa8d072a2007-01-05 07:46:25819------------------------------------------------------------------------
820
Junio C Hamano48bc1ce2009-07-09 16:49:19821The initial 'git svn clone' can be quite time-consuming
Junio C Hamanoe9bfa9b2007-08-07 06:06:11822(especially for large Subversion repositories). If multiple
823people (or one person with multiple machines) want to use
Junio C Hamano48bc1ce2009-07-09 16:49:19824'git svn' to interact with the same Subversion repository, you can
825do the initial 'git svn clone' to a repository on a server and
826have each person clone that repository with 'git clone':
Junio C Hamanoe9bfa9b2007-08-07 06:06:11827
828------------------------------------------------------------------------
829# Do the initial import on a server
Junio C Hamanoa476efa2008-10-10 15:31:42830ssh server "cd /pub && git svn clone http://svn.example.com/project
Junio C Hamanof7bb6692008-01-27 08:23:46831# Clone locally - make sure the refs/remotes/ space matches the server
832mkdir project
833cd project
Junio C Hamanofce7c7e2008-07-02 03:06:38834git init
Junio C Hamanof7bb6692008-01-27 08:23:46835git remote add origin server:/pub/project
Junio C Hamanob218ad82011-01-08 00:21:03836git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
Junio C Hamanof7bb6692008-01-27 08:23:46837git fetch
Junio C Hamano076ffcc2013-02-06 05:13:21838# Prevent fetch/pull from remote Git server in the future,
Junio C Hamanob218ad82011-01-08 00:21:03839# we only want to use git svn for future updates
840git config --remove-section remote.origin
Junio C Hamanod3452a02008-11-15 08:07:55841# Create a local branch from one of the branches just fetched
842git checkout -b master FETCH_HEAD
Junio C Hamano48bc1ce2009-07-09 16:49:19843# 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:42844git svn init http://svn.example.com/project
Junio C Hamanoe9bfa9b2007-08-07 06:06:11845# Pull the latest changes from Subversion
Junio C Hamanofce7c7e2008-07-02 03:06:38846git svn rebase
Junio C Hamanoe9bfa9b2007-08-07 06:06:11847------------------------------------------------------------------------
848
Junio C Hamano79770b62007-01-07 07:43:58849REBASE VS. PULL/MERGE
850---------------------
Junio C Hamanof94fd6c2012-05-17 22:55:14851Prefer to use 'git svn rebase' or 'git rebase', rather than
852'git pull' or 'git merge' to synchronize unintegrated commits with a 'git svn'
853branch. Doing so will keep the history of unintegrated commits linear with
854respect to the upstream SVN repository and allow the use of the preferred
855'git svn dcommit' subcommand to push unintegrated commits back into SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31856
Junio C Hamanof94fd6c2012-05-17 22:55:14857Originally, 'git svn' recommended that developers pulled or merged from
858the 'git svn' branch. This was because the author favored
Junio C Hamanofce7c7e2008-07-02 03:06:38859`git svn set-tree B` to commit a single head rather than the
Junio C Hamanof94fd6c2012-05-17 22:55:14860`git svn set-tree A..B` notation to commit multiple commits. Use of
861'git pull' or 'git merge' with `git svn set-tree A..B` will cause non-linear
862history to be flattened when committing into SVN and this can lead to merge
863commits unexpectedly reversing previous commits in SVN.
Junio C Hamano6b2cee12006-08-26 08:43:31864
Junio C Hamanob77f8192011-05-05 01:30:38865MERGE TRACKING
866--------------
867While 'git svn' can track
Junio C Hamanod2d9ae12007-09-19 02:27:57868copy history (including branches and tags) for repositories adopting a
869standard layout, it cannot yet represent merge history that happened
870inside git back upstream to SVN users. Therefore it is advised that
Junio C Hamano076ffcc2013-02-06 05:13:21871users keep history as linear as possible inside Git to ease
Junio C Hamanod2d9ae12007-09-19 02:27:57872compatibility with SVN (see the CAVEATS section below).
Junio C Hamano9ae1a062006-07-10 08:12:34873
Junio C Hamanodb81b992012-12-21 23:49:12874HANDLING OF SVN BRANCHES
875------------------------
876If 'git svn' is configured to fetch branches (and --follow-branches
Junio C Hamano076ffcc2013-02-06 05:13:21877is in effect), it sometimes creates multiple Git branches for one
Junio C Hamanoa080bc32013-04-12 21:33:01878SVN branch, where the additional branches have names of the form
Junio C Hamanodb81b992012-12-21 23:49:12879'branchname@nnn' (with nnn an SVN revision number). These additional
880branches are created if 'git svn' cannot find a parent commit for the
881first commit in an SVN branch, to connect the branch to the history of
882the other branches.
883
884Normally, the first commit in an SVN branch consists
885of a copy operation. 'git svn' will read this commit to get the SVN
886revision the branch was created from. It will then try to find the
Junio C Hamano076ffcc2013-02-06 05:13:21887Git commit that corresponds to this SVN revision, and use that as the
Junio C Hamanodb81b992012-12-21 23:49:12888parent of the branch. However, it is possible that there is no suitable
Junio C Hamano076ffcc2013-02-06 05:13:21889Git commit to serve as parent. This will happen, among other reasons,
Junio C Hamanodb81b992012-12-21 23:49:12890if the SVN branch is a copy of a revision that was not fetched by 'git
891svn' (e.g. because it is an old revision that was skipped with
892'--revision'), or if in SVN a directory was copied that is not tracked
893by 'git svn' (such as a branch that is not tracked at all, or a
894subdirectory of a tracked branch). In these cases, 'git svn' will still
Junio C Hamano076ffcc2013-02-06 05:13:21895create a Git branch, but instead of using an existing Git commit as the
Junio C Hamanodb81b992012-12-21 23:49:12896parent of the branch, it will read the SVN history of the directory the
Junio C Hamano076ffcc2013-02-06 05:13:21897branch was copied from and create appropriate Git commits. This is
Junio C Hamanodb81b992012-12-21 23:49:12898indicated by the message "Initializing parent: <branchname>".
899
900Additionally, it will create a special branch named
901'<branchname>@<SVN-Revision>', where <SVN-Revision> is the SVN revision
902number the branch was copied from. This branch will point to the newly
903created parent commit of the branch. If in SVN the branch was deleted
904and later recreated from a different version, there will be multiple
905such branches with an '@'.
906
Junio C Hamano076ffcc2013-02-06 05:13:21907Note that this may mean that multiple Git commits are created for a
Junio C Hamanodb81b992012-12-21 23:49:12908single SVN revision.
909
910An example: in an SVN repository with a standard
911trunk/tags/branches layout, a directory trunk/sub is created in r.100.
912In r.200, trunk/sub is branched by copying it to branches/. 'git svn
Junio C Hamano076ffcc2013-02-06 05:13:21913clone -s' will then create a branch 'sub'. It will also create new Git
Junio C Hamanodb81b992012-12-21 23:49:12914commits for r.100 through r.199 and use these as the history of branch
Junio C Hamano076ffcc2013-02-06 05:13:21915'sub'. Thus there will be two Git commits for each revision from r.100
Junio C Hamanodb81b992012-12-21 23:49:12916to r.199 (one containing trunk/, one containing trunk/sub/). Finally,
917it will create a branch 'sub@200' pointing to the new parent commit of
918branch 'sub' (i.e. the commit for r.200 and trunk/sub/).
919
Junio C Hamanobdebabb2007-08-23 00:25:09920CAVEATS
921-------
922
Junio C Hamanob77f8192011-05-05 01:30:38923For the sake of simplicity and interoperating with Subversion,
924it is recommended that all 'git svn' users clone, fetch and dcommit
Junio C Hamano48bc1ce2009-07-09 16:49:19925directly from the SVN server, and avoid all 'git clone'/'pull'/'merge'/'push'
Junio C Hamano076ffcc2013-02-06 05:13:21926operations between Git repositories and branches. The recommended
927method of exchanging code between Git branches and users is
Junio C Hamano48bc1ce2009-07-09 16:49:19928'git format-patch' and 'git am', or just 'dcommit'ing to the SVN repository.
Junio C Hamanobdebabb2007-08-23 00:25:09929
Junio C Hamano48bc1ce2009-07-09 16:49:19930Running 'git merge' or 'git pull' is NOT recommended on a branch you
Junio C Hamanob77f8192011-05-05 01:30:38931plan to 'dcommit' from because Subversion users cannot see any
Junio C Hamano076ffcc2013-02-06 05:13:21932merges you've made. Furthermore, if you merge or pull from a Git branch
Junio C Hamanofce7c7e2008-07-02 03:06:38933that is a mirror of an SVN branch, 'dcommit' may commit to the wrong
Junio C Hamanobdebabb2007-08-23 00:25:09934branch.
935
Junio C Hamanoa5574462009-11-18 07:39:28936If you do merge, note the following rule: 'git svn dcommit' will
937attempt to commit on top of the SVN commit named in
938------------------------------------------------------------------------
939git log --grep=^git-svn-id: --first-parent -1
940------------------------------------------------------------------------
941You 'must' therefore ensure that the most recent commit of the branch
942you want to dcommit to is the 'first' parent of the merge. Chaos will
943ensue otherwise, especially if the first parent is an older commit on
944the same SVN branch.
945
Junio C Hamano48bc1ce2009-07-09 16:49:19946'git clone' does not clone branches under the refs/remotes/ hierarchy or
947any 'git svn' metadata, or config. So repositories created and managed with
948using 'git svn' should use 'rsync' for cloning, if cloning is to be done
Junio C Hamanobdebabb2007-08-23 00:25:09949at all.
950
Junio C Hamano076ffcc2013-02-06 05:13:21951Since 'dcommit' uses rebase internally, any Git branches you 'git push' to
Junio C Hamanofce7c7e2008-07-02 03:06:38952before 'dcommit' on will require forcing an overwrite of the existing ref
Junio C Hamanobdebabb2007-08-23 00:25:09953on the remote repository. This is generally considered bad practice,
Junio C Hamanofce7c7e2008-07-02 03:06:38954see the linkgit:git-push[1] documentation for details.
Junio C Hamanobdebabb2007-08-23 00:25:09955
Junio C Hamanofce7c7e2008-07-02 03:06:38956Do not use the --amend option of linkgit:git-commit[1] on a change you've
Junio C Hamanobdebabb2007-08-23 00:25:09957already dcommitted. It is considered bad practice to --amend commits
958you've already pushed to a remote repository for other users, and
959dcommit with SVN is analogous to that.
960
Junio C Hamanodb81b992012-12-21 23:49:12961When cloning an SVN repository, if none of the options for describing
962the repository layout is used (--trunk, --tags, --branches,
Junio C Hamano076ffcc2013-02-06 05:13:21963--stdlayout), 'git svn clone' will create a Git repository with
Junio C Hamanodb81b992012-12-21 23:49:12964completely linear history, where branches and tags appear as separate
965directories in the working copy. While this is the easiest way to get a
966copy of a complete repository, for projects with many branches it will
967lead to a working copy many times larger than just the trunk. Thus for
968projects using the standard directory structure (trunk/branches/tags),
969it is recommended to clone with option '--stdlayout'. If the project
970uses a non-standard structure, and/or if branches and tags are not
971required, it is easiest to only clone one directory (typically trunk),
972without giving any repository layout options. If the full history with
973branches and tags is required, the options '--trunk' / '--branches' /
974'--tags' must be used.
975
Junio C Hamano48bc1ce2009-07-09 16:49:19976When using multiple --branches or --tags, 'git svn' does not automatically
Junio C Hamano688eae02009-06-28 05:19:50977handle name collisions (for example, if two branches from different paths have
978the same name, or if a branch and a tag have the same name). In these cases,
Junio C Hamano076ffcc2013-02-06 05:13:21979use 'init' to set up your Git repository then, before your first 'fetch', edit
Junio C Hamano688eae02009-06-28 05:19:50980the .git/config file so that the branches and tags are associated with
981different name spaces. For example:
982
983branches = stable/*:refs/remotes/svn/stable/*
984branches = debug/*:refs/remotes/svn/debug/*
985
Junio C Hamano9ae1a062006-07-10 08:12:34986BUGS
987----
Junio C Hamano43d01342006-10-12 04:07:32988
Junio C Hamano00cb3712007-02-23 11:13:52989We ignore all SVN properties except svn:executable. Any unhandled
990properties are logged to $GIT_DIR/svn/<refname>/unhandled.log
Junio C Hamano9ae1a062006-07-10 08:12:34991
Junio C Hamano076ffcc2013-02-06 05:13:21992Renamed and copied directories are not detected by Git and hence not
Junio C Hamano9ae1a062006-07-10 08:12:34993tracked when committing to SVN. I do not plan on adding support for
994this as it's quite difficult and time-consuming to get working for all
Junio C Hamano076ffcc2013-02-06 05:13:21995the possible corner cases (Git doesn't do it, either). Committing
Junio C Hamanob77f8192011-05-05 01:30:38996renamed and copied files is fully supported if they're similar enough
Junio C Hamano076ffcc2013-02-06 05:13:21997for Git to detect them.
Junio C Hamano00cb3712007-02-23 11:13:52998
Junio C Hamanodb81b992012-12-21 23:49:12999In SVN, it is possible (though discouraged) to commit changes to a tag
1000(because a tag is just a directory copy, thus technically the same as a
1001branch). When cloning an SVN repository, 'git svn' cannot know if such a
1002commit to a tag will happen in the future. Thus it acts conservatively
1003and imports all SVN tags as branches, prefixing the tag name with 'tags/'.
1004
Junio C Hamano00cb3712007-02-23 11:13:521005CONFIGURATION
1006-------------
1007
Junio C Hamano48bc1ce2009-07-09 16:49:191008'git svn' stores [svn-remote] configuration information in the
Junio C Hamano076ffcc2013-02-06 05:13:211009repository .git/config file. It is similar the core Git
Junio C Hamano00cb3712007-02-23 11:13:521010[remote] sections except 'fetch' keys do not accept glob
1011arguments; but they are instead handled by the 'branches'
1012and 'tags' keys. Since some SVN repositories are oddly
1013configured with multiple projects glob expansions such those
1014listed below are allowed:
1015
1016------------------------------------------------------------------------
1017[svn-remote "project-a"]
1018url = http://server.org/svn
Junio C Hamano9572e922009-04-02 06:52:031019fetch = trunk/project-a:refs/remotes/project-a/trunk
Junio C Hamano00cb3712007-02-23 11:13:521020branches = branches/*/project-a:refs/remotes/project-a/branches/*
1021tags = tags/*/project-a:refs/remotes/project-a/tags/*
Junio C Hamano00cb3712007-02-23 11:13:521022------------------------------------------------------------------------
1023
Junio C Hamano07738342009-04-23 03:06:561024Keep in mind that the '\*' (asterisk) wildcard of the local ref
Junio C Hamano7d9e9bd2007-08-29 07:31:471025(right of the ':') *must* be the farthest right path component;
Junio C Hamano07738342009-04-23 03:06:561026however the remote wildcard may be anywhere as long as it's an
Junio C Hamanoa6387422007-08-25 03:54:271027independent path component (surrounded by '/' or EOL). This
Junio C Hamano00cb3712007-02-23 11:13:521028type of configuration is not automatically created by 'init' and
Junio C Hamano48bc1ce2009-07-09 16:49:191029should be manually entered with a text-editor or using 'git config'.
Junio C Hamano9ae1a062006-07-10 08:12:341030
Junio C Hamanod0d892c2010-01-24 20:06:291031It is also possible to fetch a subset of branches or tags by using a
1032comma-separated list of names within braces. For example:
1033
1034------------------------------------------------------------------------
1035[svn-remote "huge-project"]
1036url = http://server.org/svn
1037fetch = trunk/src:refs/remotes/trunk
1038branches = branches/{red,green}/src:refs/remotes/branches/*
1039tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
1040------------------------------------------------------------------------
1041
Junio C Hamano48da7832013-05-21 00:14:341042Multiple fetch, branches, and tags keys are supported:
1043
1044------------------------------------------------------------------------
1045[svn-remote "messy-repo"]
1046url = http://server.org/svn
1047fetch = trunk/project-a:refs/remotes/project-a/trunk
1048fetch = branches/demos/june-project-a-demo:refs/remotes/project-a/demos/june-demo
1049branches = branches/server/*:refs/remotes/project-a/branches/*
1050branches = branches/demos/2011/*:refs/remotes/project-a/2011-demos/*
1051tags = tags/server/*:refs/remotes/project-a/tags/*
1052------------------------------------------------------------------------
1053
1054Creating a branch in such a configuration requires disambiguating which
1055location to use using the -d or --destination flag:
1056
1057------------------------------------------------------------------------
1058$ git svn branch -d branches/server release-2-3-0
1059------------------------------------------------------------------------
1060
Junio C Hamanod0d892c2010-01-24 20:06:291061Note that git-svn keeps track of the highest revision in which a branch
1062or tag has appeared. If the subset of branches or tags is changed after
1063fetching, then .git/svn/.metadata must be manually edited to remove (or
1064reset) branches-maxRev and/or tags-maxRev as appropriate.
1065
Junio C Hamano6b2cee12006-08-26 08:43:311066SEE ALSO
1067--------
Junio C Hamano35738e82008-01-07 07:55:461068linkgit:git-rebase[1]
Junio C Hamano6b2cee12006-08-26 08:43:311069
Junio C Hamano5f3d8392011-03-15 23:33:351070GIT
1071---
1072Part of the linkgit:git[1] suite