1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
\r
4 <article lang="en" id="git-svn(1)">
\r
6 <title>git-svn(1)</title>
\r
8 <primary>git-svn(1)</primary>
\r
11 <simplesect id="_name">
\r
13 <simpara>git-svn - Bidirectional operation between a single Subversion branch and git</simpara>
\r
15 <simplesect id="_synopsis">
\r
16 <title>SYNOPSIS</title>
\r
17 <simpara><emphasis>git svn</emphasis> <command> [options] [arguments]</simpara>
\r
19 <simplesect id="_description">
\r
20 <title>DESCRIPTION</title>
\r
21 <simpara><emphasis>git-svn</emphasis> is a simple conduit for changesets between Subversion and git.
\r
22 It provides a bidirectional flow of changes between a Subversion and a git
\r
23 repository.</simpara>
\r
24 <simpara><emphasis>git-svn</emphasis> can track a single Subversion branch simply by using a
\r
25 URL to the branch, follow branches laid out in the Subversion recommended
\r
26 method (trunk, branches, tags directories) with the --stdlayout option, or
\r
27 follow branches in any layout with the -T/-t/-b options (see options to
\r
28 <emphasis>init</emphasis> below, and also the <emphasis>clone</emphasis> command).</simpara>
\r
29 <simpara>Once tracking a Subversion branch (with any of the above methods), the git
\r
30 repository can be updated from Subversion by the <emphasis>fetch</emphasis> command and
\r
31 Subversion updated from git by the <emphasis>dcommit</emphasis> command.</simpara>
\r
33 <simplesect id="_commands">
\r
34 <title>COMMANDS</title>
\r
38 <emphasis>init</emphasis>
\r
42 Initializes an empty git repository with additional
\r
43 metadata directories for <emphasis>git-svn</emphasis>. The Subversion URL
\r
44 may be specified as a command-line argument, or as full
\r
45 URL arguments to -T/-t/-b. Optionally, the target
\r
46 directory to operate on can be specified as a second
\r
47 argument. Normally this command initializes the current
\r
53 -T<trunk_subdir>
\r
56 --trunk=<trunk_subdir>
\r
59 -t<tags_subdir>
\r
62 --tags=<tags_subdir>
\r
65 -b<branches_subdir>
\r
68 --branches=<branches_subdir>
\r
78 These are optional command-line options for init. Each of
\r
79 these flags can point to a relative repository path
\r
80 (--tags=project/tags') or a full url
\r
81 (--tags=https://foo.org/project/tags). The option --stdlayout is
\r
82 a shorthand way of setting trunk,tags,branches as the relative paths,
\r
83 which is the Subversion default. If any of the other options are given
\r
84 as well, they take precedence.
\r
94 Set the <emphasis>noMetadata</emphasis> option in the [svn-remote] config.
\r
104 Set the <emphasis>useSvmProps</emphasis> option in the [svn-remote] config.
\r
110 --use-svnsync-props
\r
114 Set the <emphasis>useSvnsyncProps</emphasis> option in the [svn-remote] config.
\r
120 --rewrite-root=<URL>
\r
124 Set the <emphasis>rewriteRoot</emphasis> option in the [svn-remote] config.
\r
134 When retrieving svn commits into git (as part of fetch, rebase, or
\r
135 dcommit operations), look for the first From: or Signed-off-by: line
\r
136 in the log message and use that as the author string.
\r
146 When committing to svn from git (as part of commit or dcommit
\r
147 operations), if the existing log message doesn’t already have a
\r
148 From: or Signed-off-by: line, append a From: line based on the
\r
149 git commit’s author string. If you use this, then --use-log-author
\r
150 will retrieve a valid author string for all commits.
\r
156 --username=<USER>
\r
160 For transports that SVN handles authentication for (http,
\r
161 https, and plain svn), specify the username. For other
\r
162 transports (eg svn+ssh://), you must include the username in
\r
163 the URL, eg svn+ssh://<ulink url="mailto:foo@svn.bar.com">foo@svn.bar.com</ulink>/project
\r
169 --prefix=<prefix>
\r
173 This allows one to specify a prefix which is prepended
\r
174 to the names of remotes if trunk/branches/tags are
\r
175 specified. The prefix does not automatically include a
\r
176 trailing slash, so be sure you include one in the
\r
177 argument if that is what you want. If --branches/-b is
\r
178 specified, the prefix must include a trailing slash.
\r
179 Setting a prefix is useful if you wish to track multiple
\r
180 projects that share a common repository.
\r
189 <emphasis>fetch</emphasis>
\r
193 Fetch unfetched revisions from the Subversion remote we are
\r
194 tracking. The name of the [svn-remote "…"] section in the
\r
195 .git/config file may be specified as an optional command-line
\r
205 Store Git commit times in the local timezone instead of UTC. This
\r
206 makes <emphasis>git-log</emphasis> (even without --date=local) show the same times
\r
207 that <literal>svn log</literal> would in the local timezone.
\r
215 <simpara>This doesn’t interfere with interoperating with the Subversion
\r
216 repository you cloned from, but if you wish for your local Git
\r
217 repository to be able to interoperate with someone else’s local Git
\r
218 repository, either don’t use this option or you should both use it in
\r
219 the same local timezone.</simpara>
\r
223 --ignore-paths=<regex>
\r
227 This allows one to specify Perl regular expression that will
\r
228 cause skipping of all matching paths from checkout from SVN.
\r
231 <literallayout class="monospaced">--ignore-paths="^doc" - skip "doc*" directory for every fetch.</literallayout>
\r
232 <literallayout class="monospaced">--ignore-paths="^[^/]+/(?:branches|tags)" - skip "branches"
\r
233 and "tags" of first level directories.</literallayout>
\r
234 <literallayout class="monospaced">Regular expression is not persistent, you should specify
\r
235 it every time when fetching.</literallayout>
\r
239 <emphasis>clone</emphasis>
\r
243 Runs <emphasis>init</emphasis> and <emphasis>fetch</emphasis>. It will automatically create a
\r
244 directory based on the basename of the URL passed to it;
\r
245 or if a second argument is passed; it will create a directory
\r
246 and work within that. It accepts all arguments that the
\r
247 <emphasis>init</emphasis> and <emphasis>fetch</emphasis> commands accept; with the exception of
\r
248 <emphasis>--fetch-all</emphasis>. After a repository is cloned, the <emphasis>fetch</emphasis>
\r
249 command will be able to update revisions without affecting
\r
250 the working tree; and the <emphasis>rebase</emphasis> command will be able
\r
251 to update the working tree with the latest changes.
\r
257 <emphasis>rebase</emphasis>
\r
261 This fetches revisions from the SVN parent of the current HEAD
\r
262 and rebases the current (uncommitted to SVN) work against it.
\r
270 <simpara>This works similarly to <literal>svn update</literal> or <emphasis>git-pull</emphasis> except that
\r
271 it preserves linear history with <emphasis>git-rebase</emphasis> instead of
\r
272 <emphasis>git-merge</emphasis> for ease of dcommitting with <emphasis>git-svn</emphasis>.</simpara>
\r
273 <simpara>This accepts all options that <emphasis>git-svn fetch</emphasis> and <emphasis>git-rebase</emphasis>
\r
274 accept. However, <emphasis>--fetch-all</emphasis> only fetches from the current
\r
275 [svn-remote], and not all [svn-remote] definitions.</simpara>
\r
276 <simpara>Like <emphasis>git-rebase</emphasis>; this requires that the working tree be clean
\r
277 and have no uncommitted changes.</simpara>
\r
288 Do not fetch remotely; only run <emphasis>git-rebase</emphasis> against the
\r
289 last fetched commit from the upstream SVN.
\r
294 <emphasis>dcommit</emphasis>
\r
298 Commit each diff from a specified head directly to the SVN
\r
299 repository, and then rebase or reset (depending on whether or
\r
300 not there is a diff between SVN and head). This will create
\r
301 a revision in SVN for each commit in git.
\r
302 It is recommended that you run <emphasis>git-svn</emphasis> fetch and rebase (not
\r
303 pull or merge) your commits against the latest changes in the
\r
305 An optional command-line argument may be specified as an
\r
306 alternative to HEAD.
\r
307 This is advantageous over <emphasis>set-tree</emphasis> (below) because it produces
\r
308 cleaner, more linear history.
\r
321 After committing, do not rebase or reset.
\r
327 --commit-url <URL>
\r
331 Commit to this SVN URL (the full path). This is intended to
\r
332 allow existing git-svn repositories created with one transport
\r
333 method (e.g. <literal>svn://</literal> or <literal>http://</literal> for anonymous read) to be
\r
334 reused if a user is later given access to an alternate transport
\r
335 method (e.g. <literal>svn+ssh://</literal> or <literal>https://</literal>) for commit.
\r
337 <literallayout class="monospaced">Using this option for any other purpose (don't ask)
\r
338 is very strongly discouraged.</literallayout>
\r
345 <emphasis>branch</emphasis>
\r
349 Create a branch in the SVN repository.
\r
361 Allows to specify the commit message.
\r
374 Create a tag by using the tags_subdir instead of the branches_subdir
\r
375 specified during git svn init.
\r
384 <emphasis>tag</emphasis>
\r
388 Create a tag in the SVN repository. This is a shorthand for
\r
389 <emphasis>branch -t</emphasis>.
\r
395 <emphasis>log</emphasis>
\r
399 This should make it easy to look up svn log messages when svn
\r
400 users refer to -r/--revision numbers.
\r
402 <simpara>The following features from ‘svn log’ are supported:</simpara>
\r
406 --revision=<n>[:<n>]
\r
410 is supported, non-numeric args are not:
\r
411 HEAD, NEXT, BASE, PREV, etc …
\r
421 it’s not completely compatible with the --verbose
\r
422 output in svn log, but reasonably close.
\r
432 is NOT the same as --max-count, doesn’t count
\r
433 merged/excluded commits
\r
448 <simpara>New features:</simpara>
\r
456 shows the git commit sha1, as well
\r
466 our version of --pretty=oneline
\r
471 <note><simpara>SVN itself only stores times in UTC and nothing else. The regular svn
\r
472 client converts the UTC time to the local time (or based on the TZ=
\r
473 environment). This command has the same behaviour.</simpara></note>
\r
474 <simpara>Any other arguments are passed directly to <emphasis>git-log</emphasis></simpara>
\r
479 <emphasis>blame</emphasis>
\r
483 Show what revision and author last modified each line of a file. The
\r
484 output of this mode is format-compatible with the output of
\r
485 ‘svn blame’ by default. Like the SVN blame command,
\r
486 local uncommitted changes in the working copy are ignored;
\r
487 the version of the file in the HEAD revision is annotated. Unknown
\r
488 arguments are passed directly to <emphasis>git-blame</emphasis>.
\r
497 Produce output in the same format as <emphasis>git-blame</emphasis>, but with
\r
498 SVN revision numbers instead of git commit hashes. In this mode,
\r
499 changes that haven’t been committed to SVN (including local
\r
500 working-copy edits) are shown as revision 0.
\r
511 <emphasis>find-rev</emphasis>
\r
515 When given an SVN revision number of the form <emphasis>rN</emphasis>, returns the
\r
516 corresponding git commit hash (this can optionally be followed by a
\r
517 tree-ish to specify which branch should be searched). When given a
\r
518 tree-ish, returns the corresponding SVN revision number.
\r
524 <emphasis>set-tree</emphasis>
\r
528 You should consider using <emphasis>dcommit</emphasis> instead of this command.
\r
529 Commit specified commit or tree objects to SVN. This relies on
\r
530 your imported fetch data being up-to-date. This makes
\r
531 absolutely no attempts to do patching when committing to SVN, it
\r
532 simply overwrites files with those specified in the tree or
\r
533 commit. All merging is assumed to have taken place
\r
534 independently of <emphasis>git-svn</emphasis> functions.
\r
540 <emphasis>create-ignore</emphasis>
\r
544 Recursively finds the svn:ignore property on directories and
\r
545 creates matching .gitignore files. The resulting files are staged to
\r
546 be committed, but are not committed. Use -r/--revision to refer to a
\r
553 <emphasis>show-ignore</emphasis>
\r
557 Recursively finds and lists the svn:ignore property on
\r
558 directories. The output is suitable for appending to
\r
559 the $GIT_DIR/info/exclude file.
\r
565 <emphasis>commit-diff</emphasis>
\r
569 Commits the diff of two tree-ish arguments from the
\r
570 command-line. This command does not rely on being inside an <literal>git-svn
\r
571 init</literal>-ed repository. This command takes three arguments, (a) the
\r
572 original tree to diff against, (b) the new tree result, (c) the
\r
573 URL of the target Subversion repository. The final argument
\r
574 (URL) may be omitted if you are working from a <emphasis>git-svn</emphasis>-aware
\r
575 repository (that has been <literal>init</literal>-ed with <emphasis>git-svn</emphasis>).
\r
576 The -r<revision> option is required for this.
\r
582 <emphasis>info</emphasis>
\r
586 Shows information about a file or directory similar to what
\r
587 ‘svn info’ provides. Does not currently support a -r/--revision
\r
588 argument. Use the --url option to output only the value of the
\r
589 <emphasis>URL:</emphasis> field.
\r
595 <emphasis>proplist</emphasis>
\r
599 Lists the properties stored in the Subversion repository about a
\r
600 given file or directory. Use -r/--revision to refer to a specific
\r
601 Subversion revision.
\r
607 <emphasis>propget</emphasis>
\r
611 Gets the Subversion property given as the first argument, for a
\r
612 file. A specific revision can be specified with -r/--revision.
\r
618 <emphasis>show-externals</emphasis>
\r
622 Shows the Subversion externals. Use -r/--revision to specify a
\r
629 <simplesect id="_options">
\r
630 <title>OPTIONS</title>
\r
634 --shared[={false|true|umask|group|all|world|everybody}]
\r
637 --template=<template_directory>
\r
641 Only used with the <emphasis>init</emphasis> command.
\r
642 These are passed directly to <emphasis>git-init</emphasis>.
\r
651 --revision <ARG>
\r
655 Used with the <emphasis>fetch</emphasis> command.
\r
660 <simpara>This allows revision ranges for partial/cauterized history
\r
661 to be supported. $NUMBER, $NUMBER1:$NUMBER2 (numeric ranges),
\r
662 $NUMBER:HEAD, and BASE:$NUMBER are all supported.</simpara>
\r
663 <simpara>This can allow you to make partial mirrors when running fetch;
\r
664 but is generally not recommended because history will be skipped
\r
665 and lost.</simpara>
\r
676 Only used with the <emphasis>set-tree</emphasis> command.
\r
681 <simpara>Read a list of commits from stdin and commit them in reverse
\r
682 order. Only the leading sha1 is read from each line, so
\r
683 <emphasis>git-rev-list --pretty=oneline</emphasis> output can be used.</simpara>
\r
691 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
696 <simpara>Remove directories from the SVN tree if there are no files left
\r
697 behind. SVN can version empty directories, and they are not
\r
698 removed by default if there are no files left in them. git
\r
699 cannot version empty directories. Enabling this flag will make
\r
700 the commit to SVN act like git.</simpara>
\r
701 <simpara>config key: svn.rmdir</simpara>
\r
712 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
717 <simpara>Edit the commit message before committing to SVN. This is off by
\r
718 default for objects that are commits, and forced on when committing
\r
719 tree objects.</simpara>
\r
720 <simpara>config key: svn.edit</simpara>
\r
727 --find-copies-harder
\r
731 Only used with the <emphasis>dcommit</emphasis>, <emphasis>set-tree</emphasis> and <emphasis>commit-diff</emphasis> commands.
\r
736 <simpara>They are both passed directly to <emphasis>git-diff-tree</emphasis>; see
\r
737 <xref linkend="git-diff-tree(1)"/> for more information.</simpara>
\r
739 <literallayout>config key: svn.l
\r
740 config key: svn.findcopiesharder</literallayout>
\r
748 --authors-file=<filename>
\r
752 Syntax is compatible with the file used by <emphasis>git-cvsimport</emphasis>:
\r
757 <literallayout> loginname = Joe User <user@example.com></literallayout>
\r
758 <simpara>If this option is specified and <emphasis>git-svn</emphasis> encounters an SVN
\r
759 committer name that does not exist in the authors-file, <emphasis>git-svn</emphasis>
\r
760 will abort operation. The user will then have to add the
\r
761 appropriate entry. Re-running the previous <emphasis>git-svn</emphasis> command
\r
762 after the authors-file is modified should continue operation.</simpara>
\r
763 <simpara>config key: svn.authorsfile</simpara>
\r
774 Make <emphasis>git-svn</emphasis> less verbose.
\r
780 --repack[=<n>]
\r
783 --repack-flags=<flags>
\r
787 These should help keep disk usage sane for large fetches
\r
788 with many revisions.
\r
793 <simpara>--repack takes an optional argument for the number of revisions
\r
794 to fetch before repacking. This defaults to repacking every
\r
795 1000 commits fetched if no argument is specified.</simpara>
\r
796 <simpara>--repack-flags are passed directly to <emphasis>git-repack</emphasis>.</simpara>
\r
798 <literallayout>config key: svn.repack
\r
799 config key: svn.repackflags</literallayout>
\r
813 --strategy=<strategy>
\r
817 These are only used with the <emphasis>dcommit</emphasis> and <emphasis>rebase</emphasis> commands.
\r
822 <simpara>Passed directly to <emphasis>git-rebase</emphasis> when using <emphasis>dcommit</emphasis> if a
\r
823 <emphasis>git-reset</emphasis> cannot be used (see <emphasis>dcommit</emphasis>).</simpara>
\r
834 This can be used with the <emphasis>dcommit</emphasis>, <emphasis>rebase</emphasis>, <emphasis>branch</emphasis> and <emphasis>tag</emphasis>
\r
840 <simpara>For <emphasis>dcommit</emphasis>, print out the series of git arguments that would show
\r
841 which diffs would be committed to SVN.</simpara>
\r
842 <simpara>For <emphasis>rebase</emphasis>, display the local branch associated with the upstream svn
\r
843 repository associated with the current branch and the URL of svn
\r
844 repository that will be fetched from.</simpara>
\r
845 <simpara>For <emphasis>branch</emphasis> and <emphasis>tag</emphasis>, display the urls that will be used for copying when
\r
846 creating the branch or tag.</simpara>
\r
848 <simplesect id="_advanced_options">
\r
849 <title>ADVANCED OPTIONS</title>
\r
853 -i<GIT_SVN_ID>
\r
856 --id <GIT_SVN_ID>
\r
860 This sets GIT_SVN_ID (instead of using the environment). This
\r
861 allows the user to override the default refname to fetch from
\r
862 when tracking a single URL. The <emphasis>log</emphasis> and <emphasis>dcommit</emphasis> commands
\r
863 no longer require this switch as an argument.
\r
869 -R<remote name>
\r
872 --svn-remote <remote name>
\r
876 Specify the [svn-remote "<remote name>"] section to use,
\r
877 this allows SVN multiple repositories to be tracked.
\r
888 This is especially helpful when we’re tracking a directory
\r
889 that has been moved around within the repository, or if we
\r
890 started tracking a branch and never tracked the trunk it was
\r
891 descended from. This feature is enabled by default, use
\r
892 --no-follow-parent to disable it.
\r
897 <simpara>config key: svn.followparent</simpara>
\r
899 <simplesect id="_config_file_only_options">
\r
900 <title>CONFIG FILE-ONLY OPTIONS</title>
\r
907 svn-remote.<name>.noMetadata
\r
911 This gets rid of the <emphasis>git-svn-id:</emphasis> lines at the end of every commit.
\r
916 <simpara>If you lose your .git/svn/git-svn/.rev_db file, <emphasis>git-svn</emphasis> will not
\r
917 be able to rebuild it and you won’t be able to fetch again,
\r
918 either. This is fine for one-shot imports.</simpara>
\r
919 <simpara>The <emphasis>git-svn log</emphasis> command will not work on repositories using
\r
920 this, either. Using this conflicts with the <emphasis>useSvmProps</emphasis>
\r
921 option for (hopefully) obvious reasons.</simpara>
\r
928 svn-remote.<name>.useSvmProps
\r
932 This allows <emphasis>git-svn</emphasis> to re-map repository URLs and UUIDs from
\r
933 mirrors created using SVN::Mirror (or svk) for metadata.
\r
938 <simpara>If an SVN revision has a property, "svm:headrev", it is likely
\r
939 that the revision was created by SVN::Mirror (also used by SVK).
\r
940 The property contains a repository UUID and a revision. We want
\r
941 to make it look like we are mirroring the original URL, so
\r
942 introduce a helper function that returns the original identity
\r
943 URL and UUID, and use it when generating metadata in commit
\r
944 messages.</simpara>
\r
948 svn.useSvnsyncProps
\r
951 svn-remote.<name>.useSvnsyncprops
\r
955 Similar to the useSvmProps option; this is for users
\r
956 of the svnsync(1) command distributed with SVN 1.4.x and
\r
963 svn-remote.<name>.rewriteRoot
\r
967 This allows users to create repositories from alternate
\r
968 URLs. For example, an administrator could run <emphasis>git-svn</emphasis> on the
\r
969 server locally (accessing via file://) but wish to distribute
\r
970 the repository with a public http:// or svn:// URL in the
\r
971 metadata so users of it will see the public URL.
\r
976 <simpara>Since the noMetadata, rewriteRoot, useSvnsyncProps and useSvmProps
\r
977 options all affect the metadata generated and used by <emphasis>git-svn</emphasis>; they
\r
978 <emphasis role="strong">must</emphasis> be set in the configuration file before any history is imported
\r
979 and these settings should never be changed once they are set.</simpara>
\r
980 <simpara>Additionally, only one of these four options can be used per-svn-remote
\r
981 section because they affect the <emphasis>git-svn-id:</emphasis> metadata line.</simpara>
\r
983 <simplesect id="_basic_examples">
\r
984 <title>BASIC EXAMPLES</title>
\r
985 <simpara>Tracking and contributing to the trunk of a Subversion-managed project:</simpara>
\r
986 <literallayout># Clone a repo (like git clone):
\r
987 git svn clone http://svn.example.com/project/trunk
\r
988 # Enter the newly cloned directory:
\r
990 # You should be on master branch, double-check with git-branch
\r
992 # Do some work and commit locally to git:
\r
994 # Something is committed to SVN, rebase your local changes against the
\r
995 # latest changes in SVN:
\r
997 # Now commit your changes (that were committed previously using git) to SVN,
\r
998 # as well as automatically updating your working HEAD:
\r
1000 # Append svn:ignore settings to the default git exclude file:
\r
1001 git svn show-ignore >> .git/info/exclude</literallayout>
\r
1002 <simpara>Tracking and contributing to an entire Subversion-managed project
\r
1003 (complete with a trunk, tags and branches):</simpara>
\r
1004 <literallayout># Clone a repo (like git clone):
\r
1005 git svn clone http://svn.example.com/project -T trunk -b branches -t tags
\r
1006 # View all branches and tags you have cloned:
\r
1008 # Create a new branch in SVN
\r
1009 git svn branch waldo
\r
1010 # Reset your master to trunk (or any other branch, replacing 'trunk'
\r
1011 # with the appropriate name):
\r
1012 git reset --hard remotes/trunk
\r
1013 # You may only dcommit to one branch/tag/trunk at a time. The usage
\r
1014 # of dcommit/rebase/show-ignore should be the same as above.</literallayout>
\r
1015 <simpara>The initial <emphasis>git-svn clone</emphasis> can be quite time-consuming
\r
1016 (especially for large Subversion repositories). If multiple
\r
1017 people (or one person with multiple machines) want to use
\r
1018 <emphasis>git-svn</emphasis> to interact with the same Subversion repository, you can
\r
1019 do the initial <emphasis>git-svn clone</emphasis> to a repository on a server and
\r
1020 have each person clone that repository with <emphasis>git-clone</emphasis>:</simpara>
\r
1021 <literallayout># Do the initial import on a server
\r
1022 ssh server "cd /pub && git svn clone http://svn.example.com/project
\r
1023 # Clone locally - make sure the refs/remotes/ space matches the server
\r
1027 git remote add origin server:/pub/project
\r
1028 git config --add remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
\r
1030 # Create a local branch from one of the branches just fetched
\r
1031 git checkout -b master FETCH_HEAD
\r
1032 # Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)
\r
1033 git svn init http://svn.example.com/project
\r
1034 # Pull the latest changes from Subversion
\r
1035 git svn rebase</literallayout>
\r
1037 <simplesect id="_rebase_vs_pull_merge">
\r
1038 <title>REBASE VS. PULL/MERGE</title>
\r
1039 <simpara>Originally, <emphasis>git-svn</emphasis> recommended that the <emphasis>remotes/git-svn</emphasis> branch be
\r
1040 pulled or merged from. This is because the author favored
\r
1041 <literal>git svn set-tree B</literal> to commit a single head rather than the
\r
1042 <literal>git svn set-tree A..B</literal> notation to commit multiple commits.</simpara>
\r
1043 <simpara>If you use ‘git svn set-tree A..B` to commit several diffs and you do
\r
1044 not have the latest remotes/git-svn merged into my-branch, you should
\r
1045 use <literal>git svn rebase</literal> to update your work branch instead of <literal>git pull</literal> or
\r
1046 <literal>git merge</literal>. <literal>pull</literal>/`merge’ can cause non-linear history to be flattened
\r
1047 when committing into SVN, which can lead to merge commits reversing
\r
1048 previous commits in SVN.</simpara>
\r
1050 <simplesect id="_design_philosophy">
\r
1051 <title>DESIGN PHILOSOPHY</title>
\r
1052 <simpara>Merge tracking in Subversion is lacking and doing branched development
\r
1053 with Subversion can be cumbersome as a result. While <emphasis>git-svn</emphasis> can track
\r
1054 copy history (including branches and tags) for repositories adopting a
\r
1055 standard layout, it cannot yet represent merge history that happened
\r
1056 inside git back upstream to SVN users. Therefore it is advised that
\r
1057 users keep history as linear as possible inside git to ease
\r
1058 compatibility with SVN (see the CAVEATS section below).</simpara>
\r
1060 <simplesect id="_caveats">
\r
1061 <title>CAVEATS</title>
\r
1062 <simpara>For the sake of simplicity and interoperating with a less-capable system
\r
1063 (SVN), it is recommended that all <emphasis>git-svn</emphasis> users clone, fetch and dcommit
\r
1064 directly from the SVN server, and avoid all <emphasis>git-clone</emphasis>/<emphasis>pull</emphasis>/<emphasis>merge</emphasis>/<emphasis>push</emphasis>
\r
1065 operations between git repositories and branches. The recommended
\r
1066 method of exchanging code between git branches and users is
\r
1067 <emphasis>git-format-patch</emphasis> and <emphasis>git-am</emphasis>, or just 'dcommit’ing to the SVN repository.</simpara>
\r
1068 <simpara>Running <emphasis>git-merge</emphasis> or <emphasis>git-pull</emphasis> is NOT recommended on a branch you
\r
1069 plan to <emphasis>dcommit</emphasis> from. Subversion does not represent merges in any
\r
1070 reasonable or useful fashion; so users using Subversion cannot see any
\r
1071 merges you’ve made. Furthermore, if you merge or pull from a git branch
\r
1072 that is a mirror of an SVN branch, <emphasis>dcommit</emphasis> may commit to the wrong
\r
1074 <simpara><emphasis>git-clone</emphasis> does not clone branches under the refs/remotes/ hierarchy or
\r
1075 any <emphasis>git-svn</emphasis> metadata, or config. So repositories created and managed with
\r
1076 using <emphasis>git-svn</emphasis> should use <emphasis>rsync</emphasis> for cloning, if cloning is to be done
\r
1078 <simpara>Since <emphasis>dcommit</emphasis> uses rebase internally, any git branches you <emphasis>git-push</emphasis> to
\r
1079 before <emphasis>dcommit</emphasis> on will require forcing an overwrite of the existing ref
\r
1080 on the remote repository. This is generally considered bad practice,
\r
1081 see the <xref linkend="git-push(1)"/> documentation for details.</simpara>
\r
1082 <simpara>Do not use the --amend option of <xref linkend="git-commit(1)"/> on a change you’ve
\r
1083 already dcommitted. It is considered bad practice to --amend commits
\r
1084 you’ve already pushed to a remote repository for other users, and
\r
1085 dcommit with SVN is analogous to that.</simpara>
\r
1087 <simplesect id="_bugs">
\r
1088 <title>BUGS</title>
\r
1089 <simpara>We ignore all SVN properties except svn:executable. Any unhandled
\r
1090 properties are logged to $GIT_DIR/svn/<refname>/unhandled.log</simpara>
\r
1091 <simpara>Renamed and copied directories are not detected by git and hence not
\r
1092 tracked when committing to SVN. I do not plan on adding support for
\r
1093 this as it’s quite difficult and time-consuming to get working for all
\r
1094 the possible corner cases (git doesn’t do it, either). Committing
\r
1095 renamed and copied files are fully supported if they’re similar enough
\r
1096 for git to detect them.</simpara>
\r
1098 <simplesect id="_configuration">
\r
1099 <title>CONFIGURATION</title>
\r
1100 <simpara><emphasis>git-svn</emphasis> stores [svn-remote] configuration information in the
\r
1101 repository .git/config file. It is similar the core git
\r
1102 [remote] sections except <emphasis>fetch</emphasis> keys do not accept glob
\r
1103 arguments; but they are instead handled by the <emphasis>branches</emphasis>
\r
1104 and <emphasis>tags</emphasis> keys. Since some SVN repositories are oddly
\r
1105 configured with multiple projects glob expansions such those
\r
1106 listed below are allowed:</simpara>
\r
1107 <literallayout>[svn-remote "project-a"]
\r
1108 url = http://server.org/svn
\r
1109 branches = branches/*/project-a:refs/remotes/project-a/branches/*
\r
1110 tags = tags/*/project-a:refs/remotes/project-a/tags/*
\r
1111 trunk = trunk/project-a:refs/remotes/project-a/trunk</literallayout>
\r
1112 <simpara>Keep in mind that the <emphasis><emphasis role="strong"></emphasis> (asterisk) wildcard of the local ref
\r
1113 (right of the <emphasis>:</emphasis>) *must</emphasis> be the farthest right path component;
\r
1114 however the remote wildcard may be anywhere as long as it’s own
\r
1115 independent path component (surrounded by <emphasis>/</emphasis> or EOL). This
\r
1116 type of configuration is not automatically created by <emphasis>init</emphasis> and
\r
1117 should be manually entered with a text-editor or using <emphasis>git-config</emphasis>.</simpara>
\r
1119 <simplesect id="_see_also">
\r
1120 <title>SEE ALSO</title>
\r
1121 <simpara><xref linkend="git-rebase(1)"/></simpara>
\r
1123 <simplesect id="_author">
\r
1124 <title>Author</title>
\r
1125 <simpara>Written by Eric Wong <<ulink url="mailto:normalperson@yhbt.net">normalperson@yhbt.net</ulink>>.</simpara>
\r
1127 <simplesect id="_documentation">
\r
1128 <title>Documentation</title>
\r
1129 <simpara>Written by Eric Wong <<ulink url="mailto:normalperson@yhbt.net">normalperson@yhbt.net</ulink>>.</simpara>
\r