Code

Merge branch 'cf/maint-remote-uploadpack-useconfig-fix'
[git.git] / Documentation / git-svn.txt
index ca3fc3de1fcfc3509a9d5d1ff268c9673bafc3c0..7e9b9a042347bf286c6ea523bef1952f0c72dec9 100644 (file)
@@ -3,7 +3,7 @@ git-svn(1)
 
 NAME
 ----
 
 NAME
 ----
-git-svn - Bidirectional operation between a single Subversion branch and git
+git-svn - Bidirectional operation between a Subversion repository and git
 
 SYNOPSIS
 --------
 
 SYNOPSIS
 --------
@@ -15,13 +15,12 @@ DESCRIPTION
 It provides a bidirectional flow of changes between a Subversion and a git
 repository.
 
 It provides a bidirectional flow of changes between a Subversion and a git
 repository.
 
-'git-svn' can track a single Subversion branch simply by using a
-URL to the branch, follow branches laid out in the Subversion recommended
-method (trunk, branches, tags directories) with the --stdlayout option, or
-follow branches in any layout with the -T/-t/-b options (see options to
-'init' below, and also the 'clone' command).
+'git-svn' can track a standard Subversion repository,
+following the common "trunk/branches/tags" layout, with the --stdlayout option.
+It can also follow branches and tags in any layout with the -T/-t/-b options
+(see options to 'init' below, and also the 'clone' command).
 
 
-Once tracking a Subversion branch (with any of the above methods), the git
+Once tracking a Subversion repository (with any of the above methods), the git
 repository can be updated from Subversion by the 'fetch' command and
 Subversion updated from git by the 'dcommit' command.
 
 repository can be updated from Subversion by the 'fetch' command and
 Subversion updated from git by the 'dcommit' command.
 
@@ -48,8 +47,11 @@ COMMANDS
 --stdlayout;;
        These are optional command-line options for init.  Each of
        these flags can point to a relative repository path
 --stdlayout;;
        These are optional command-line options for init.  Each of
        these flags can point to a relative repository path
-       (--tags=project/tags') or a full url
-       (--tags=https://foo.org/project/tags). The option --stdlayout is
+       (--tags=project/tags) or a full url
+       (--tags=https://foo.org/project/tags).
+       You can specify more than one --tags and/or --branches options, in case
+       your Subversion repository places tags or branches under multiple paths.
+       The option --stdlayout is
        a shorthand way of setting trunk,tags,branches as the relative paths,
        which is the Subversion default. If any of the other options are given
        as well, they take precedence.
        a shorthand way of setting trunk,tags,branches as the relative paths,
        which is the Subversion default. If any of the other options are given
        as well, they take precedence.
@@ -170,8 +172,9 @@ and have no uncommitted changes.
        It is recommended that you run 'git-svn' fetch and rebase (not
        pull or merge) your commits against the latest changes in the
        SVN repository.
        It is recommended that you run 'git-svn' fetch and rebase (not
        pull or merge) your commits against the latest changes in the
        SVN repository.
-       An optional command-line argument may be specified as an
-       alternative to HEAD.
+       An optional revision or branch argument may be specified, and
+       causes 'git-svn' to do all work on that revision/branch
+       instead of HEAD.
        This is advantageous over 'set-tree' (below) because it produces
        cleaner, more linear history.
 +
        This is advantageous over 'set-tree' (below) because it produces
        cleaner, more linear history.
 +
@@ -204,6 +207,20 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
        Create a tag by using the tags_subdir instead of the branches_subdir
        specified during git svn init.
 
        Create a tag by using the tags_subdir instead of the branches_subdir
        specified during git svn init.
 
+-d;;
+--destination;;
+       If more than one --branches (or --tags) option was given to the 'init'
+       or 'clone' command, you must provide the location of the branch (or
+       tag) you wish to create in the SVN repository.  The value of this
+       option must match one of the paths specified by a --branches (or
+       --tags) option.  You can see these paths with the commands
++
+       git config --get-all svn-remote.<name>.branches
+       git config --get-all svn-remote.<name>.tags
++
+where <name> is the name of the SVN repository as specified by the -R option to
+'init' (or "svn" by default).
+
 'tag'::
        Create a tag in the SVN repository. This is a shorthand for
        'branch -t'.
 'tag'::
        Create a tag in the SVN repository. This is a shorthand for
        'branch -t'.
@@ -215,7 +232,7 @@ config key: svn.commiturl (overwrites all svn-remote.<name>.commiturl options)
 The following features from `svn log' are supported:
 +
 --
 The following features from `svn log' are supported:
 +
 --
---revision=<n>[:<n>];;
+-r/--revision=<n>[:<n>];;
        is supported, non-numeric args are not:
        HEAD, NEXT, BASE, PREV, etc ...
 -v/--verbose;;
        is supported, non-numeric args are not:
        HEAD, NEXT, BASE, PREV, etc ...
 -v/--verbose;;
@@ -313,6 +330,63 @@ Any other arguments are passed directly to 'git-log'
        Shows the Subversion externals.  Use -r/--revision to specify a
        specific revision.
 
        Shows the Subversion externals.  Use -r/--revision to specify a
        specific revision.
 
+'reset'::
+       Undoes the effects of 'fetch' back to the specified revision.
+       This allows you to re-'fetch' an SVN revision.  Normally the
+       contents of an SVN revision should never change and 'reset'
+       should not be necessary.  However, if SVN permissions change,
+       or if you alter your --ignore-paths option, a 'fetch' may fail
+       with "not found in commit" (file not previously visible) or
+       "checksum mismatch" (missed a modification).  If the problem
+       file cannot be ignored forever (with --ignore-paths) the only
+       way to repair the repo is to use 'reset'.
+
+Only the rev_map and refs/remotes/git-svn are changed.  Follow 'reset'
+with a 'fetch' and then 'git-reset' or 'git-rebase' to move local
+branches onto the new tree.
+
+-r/--revision=<n>;;
+       Specify the most recent revision to keep.  All later revisions
+       are discarded.
+-p/--parent;;
+       Discard the specified revision as well, keeping the nearest
+       parent instead.
+Example:;;
+Assume you have local changes in "master", but you need to refetch "r2".
+
+------------
+    r1---r2---r3 remotes/git-svn
+                \
+                 A---B master
+------------
+
+Fix the ignore-paths or SVN permissions problem that caused "r2" to
+be incomplete in the first place.  Then:
+
+[verse]
+git svn reset -r2 -p
+git svn fetch
+
+------------
+    r1---r2'--r3' remotes/git-svn
+      \
+       r2---r3---A---B master
+------------
+
+Then fixup "master" with 'git-rebase'.
+Do NOT use 'git-merge' or your history will not be compatible with a
+future 'dcommit'!
+
+[verse]
+git rebase --onto remotes/git-svn A^ master
+
+------------
+    r1---r2'--r3' remotes/git-svn
+                \
+                 A'--B' master
+------------
+
+
 --
 
 OPTIONS
 --
 
 OPTIONS
@@ -623,7 +697,7 @@ pulled or merged from.  This is because the author favored
 If you use `git svn set-tree A..B` to commit several diffs and you do
 not have the latest remotes/git-svn merged into my-branch, you should
 use `git svn rebase` to update your work branch instead of `git pull` or
 If you use `git svn set-tree A..B` to commit several diffs and you do
 not have the latest remotes/git-svn merged into my-branch, you should
 use `git svn rebase` to update your work branch instead of `git pull` or
-`git merge`.  `pull`/`merge' can cause non-linear history to be flattened
+`git merge`.  `pull`/`merge` can cause non-linear history to be flattened
 when committing into SVN, which can lead to merge commits reversing
 previous commits in SVN.
 
 when committing into SVN, which can lead to merge commits reversing
 previous commits in SVN.
 
@@ -669,6 +743,16 @@ already dcommitted.  It is considered bad practice to --amend commits
 you've already pushed to a remote repository for other users, and
 dcommit with SVN is analogous to that.
 
 you've already pushed to a remote repository for other users, and
 dcommit with SVN is analogous to that.
 
+When using multiple --branches or --tags, 'git-svn' does not automatically
+handle name collisions (for example, if two branches from different paths have
+the same name, or if a branch and a tag have the same name).  In these cases,
+use 'init' to set up your git repository then, before your first 'fetch', edit
+the .git/config file so that the branches and tags are associated with
+different name spaces.  For example:
+
+       branches = stable/*:refs/remotes/svn/stable/*
+       branches = debug/*:refs/remotes/svn/debug/*
+
 BUGS
 ----
 
 BUGS
 ----