@@ -79,8 +79,21 @@ COMMANDS
7979 trailing slash, so be sure you include one in the
8080 argument if that is what you want. If --branches/-b is
8181 specified, the prefix must include a trailing slash.
82- Setting a prefix is useful if you wish to track multiple
83- projects that share a common repository.
82+ Setting a prefix (with a trailing slash) is strongly
83+ encouraged in any case, as your SVN-tracking refs will
84+ then be located at "refs/remotes/$prefix/*", which is
85+ compatible with Git's own remote-tracking ref layout
86+ (refs/remotes/$remote/*). Setting a prefix is also useful
87+ if you wish to track multiple projects that share a common
88+ repository.
89+ +
90+ NOTE: In Git v2.0, the default prefix will CHANGE from "" (no prefix)
91+ to "origin/". This is done to put SVN-tracking refs at
92+ "refs/remotes/origin/*" instead of "refs/remotes/*", and make them
93+ more compatible with how Git's own remote-tracking refs are organized
94+ (i.e. refs/remotes/$remote/*). You can enjoy the same benefits today,
95+ by using the --prefix option.
96+
8497--ignore-paths=<regex>;;
8598 When passed to 'init' or 'clone' this regular expression will
8699 be preserved as a config key. See 'fetch' for a description
@@ -104,8 +117,11 @@ COMMANDS
104117'fetch'::
105118 Fetch unfetched revisions from the Subversion remote we are
106119 tracking. The name of the [svn-remote "..."] section in the
107- .git/config file may be specified as an optional command-line
108- argument.
120+ $GIT_DIR/config file may be specified as an optional
121+ command-line argument.
122+ +
123+ This automatically updates the rev_map if needed (see
124+ '$GIT_DIR/svn/\*\*/.rev_map.*' in the FILES section below for details).
109125
110126--localtime;;
111127 Store Git commit times in the local timezone instead of UTC. This
@@ -201,6 +217,9 @@ accept. However, '--fetch-all' only fetches from the current
201217+
202218Like 'git rebase'; this requires that the working tree be clean
203219and have no uncommitted changes.
220+ +
221+ This automatically updates the rev_map if needed (see
222+ '$GIT_DIR/svn/\*\*/.rev_map.*' in the FILES section below for details).
204223
205224-l;;
206225--local;;
@@ -435,8 +454,8 @@ Any other arguments are passed directly to 'git log'
435454 specific revision.
436455
437456'gc'::
438- Compress $GIT_DIR/svn/<refname>/unhandled.log files in .git/svn
439- and remove $GIT_DIR/svn/<refname>index files in .git/svn .
457+ Compress $GIT_DIR/svn/<refname>/unhandled.log files and remove
458+ $GIT_DIR/svn/<refname>/ index files.
440459
441460'reset'::
442461 Undoes the effects of 'fetch' back to the specified revision.
@@ -449,9 +468,10 @@ Any other arguments are passed directly to 'git log'
449468 file cannot be ignored forever (with --ignore-paths) the only
450469 way to repair the repo is to use 'reset'.
451470+
452- Only the rev_map and refs/remotes/git-svn are changed. Follow 'reset'
453- with a 'fetch' and then 'git reset' or 'git rebase' to move local
454- branches onto the new tree.
471+ Only the rev_map and refs/remotes/git-svn are changed (see
472+ '$GIT_DIR/svn/\*\*/.rev_map.*' in the FILES section below for details).
473+ Follow 'reset' with a 'fetch' and then 'git reset' or 'git rebase' to
474+ move local branches onto the new tree.
455475
456476-r <n>;;
457477--revision=<n>;;
@@ -684,7 +704,7 @@ svn-remote.<name>.noMetadata::
684704+
685705This option can only be used for one-shot imports as 'git svn'
686706will not be able to fetch again without metadata. Additionally,
687- if you lose your .git /svn/* */.rev_map.* files, 'git svn' will not
707+ if you lose your '$GIT_DIR /svn/\*\ */.rev_map.*' files, 'git svn' will not
688708be able to rebuild them.
689709+
690710The 'git svn log' command will not work on repositories using
@@ -804,16 +824,16 @@ Tracking and contributing to an entire Subversion-managed project
804824
805825------------------------------------------------------------------------
806826# Clone a repo with standard SVN directory layout (like git clone):
807- git svn clone http://svn.example.com/project --stdlayout
827+ git svn clone http://svn.example.com/project --stdlayout --prefix svn/
808828# Or, if the repo uses a non-standard directory layout:
809- git svn clone http://svn.example.com/project -T tr -b branch -t tag
829+ git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/
810830# View all branches and tags you have cloned:
811831 git branch -r
812832# Create a new branch in SVN
813833 git svn branch waldo
814834# Reset your master to trunk (or any other branch, replacing 'trunk'
815835# with the appropriate name):
816- git reset --hard remotes /trunk
836+ git reset --hard svn /trunk
817837# You may only dcommit to one branch/tag/trunk at a time. The usage
818838# of dcommit/rebase/show-ignore should be the same as above.
819839------------------------------------------------------------------------
@@ -827,7 +847,7 @@ have each person clone that repository with 'git clone':
827847
828848------------------------------------------------------------------------
829849# Do the initial import on a server
830- ssh server "cd /pub && git svn clone http://svn.example.com/project
850+ ssh server "cd /pub && git svn clone http://svn.example.com/project [options...]"
831851# Clone locally - make sure the refs/remotes/ space matches the server
832852 mkdir project
833853 cd project
@@ -840,8 +860,9 @@ have each person clone that repository with 'git clone':
840860 git config --remove-section remote.origin
841861# Create a local branch from one of the branches just fetched
842862 git checkout -b master FETCH_HEAD
843- # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
844- git svn init http://svn.example.com/project
863+ # Initialize 'git svn' locally (be sure to use the same URL and
864+ # --stdlayout/-T/-b/-t/--prefix options as were used on server)
865+ git svn init http://svn.example.com/project [options...]
845866# Pull the latest changes from Subversion
846867 git svn rebase
847868------------------------------------------------------------------------
@@ -973,12 +994,22 @@ without giving any repository layout options. If the full history with
973994branches and tags is required, the options '--trunk' / '--branches' /
974995'--tags' must be used.
975996
997+ When using the options for describing the repository layout (--trunk,
998+ --tags, --branches, --stdlayout), please also specify the --prefix
999+ option (e.g. '--prefix=origin/') to cause your SVN-tracking refs to be
1000+ placed at refs/remotes/origin/* rather than the default refs/remotes/*.
1001+ The former is more compatible with the layout of Git's "regular"
1002+ remote-tracking refs (refs/remotes/$remote/*), and may potentially
1003+ prevent similarly named SVN branches and Git remotes from clobbering
1004+ each other. In Git v2.0 the default prefix used (i.e. when no --prefix
1005+ is given) will change from "" (no prefix) to "origin/".
1006+
9761007When using multiple --branches or --tags, 'git svn' does not automatically
9771008handle name collisions (for example, if two branches from different paths have
9781009the same name, or if a branch and a tag have the same name). In these cases,
9791010use 'init' to set up your Git repository then, before your first 'fetch', edit
980- the .git /config file so that the branches and tags are associated with
981- different name spaces. For example:
1011+ the $GIT_DIR /config file so that the branches and tags are associated
1012+ with different name spaces. For example:
9821013
9831014 branches = stable/*:refs/remotes/svn/stable/*
9841015 branches = debug/*:refs/remotes/svn/debug/*
@@ -1006,7 +1037,7 @@ CONFIGURATION
10061037-------------
10071038
10081039'git svn' stores [svn-remote] configuration information in the
1009- repository .git /config file. It is similar the core Git
1040+ repository $GIT_DIR /config file. It is similar the core Git
10101041[remote] sections except 'fetch' keys do not accept glob
10111042arguments; but they are instead handled by the 'branches'
10121043and 'tags' keys. Since some SVN repositories are oddly
@@ -1035,8 +1066,8 @@ comma-separated list of names within braces. For example:
10351066[svn-remote "huge-project"]
10361067 url = http://server.org/svn
10371068 fetch = trunk/src:refs/remotes/trunk
1038- branches = branches/{red,green}/src:refs/remotes/branches/*
1039- tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
1069+ branches = branches/{red,green}/src:refs/remotes/project-a/ branches/*
1070+ tags = tags/{1.0,2.0}/src:refs/remotes/project-a/ tags/*
10401071------------------------------------------------------------------------
10411072
10421073Multiple fetch, branches, and tags keys are supported:
@@ -1060,8 +1091,21 @@ $ git svn branch -d branches/server release-2-3-0
10601091
10611092Note that git-svn keeps track of the highest revision in which a branch
10621093or tag has appeared. If the subset of branches or tags is changed after
1063- fetching, then .git/svn/.metadata must be manually edited to remove (or
1064- reset) branches-maxRev and/or tags-maxRev as appropriate.
1094+ fetching, then $GIT_DIR/svn/.metadata must be manually edited to remove
1095+ (or reset) branches-maxRev and/or tags-maxRev as appropriate.
1096+
1097+ FILES
1098+ -----
1099+ $GIT_DIR/svn/\*\*/.rev_map.*::
1100+ Mapping between Subversion revision numbers and Git commit
1101+ names. In a repository where the noMetadata option is not set,
1102+ this can be rebuilt from the git-svn-id: lines that are at the
1103+ end of every commit (see the 'svn.noMetadata' section above for
1104+ details).
1105+ +
1106+ 'git svn fetch' and 'git svn rebase' automatically update the rev_map
1107+ if it is missing or not up to date. 'git svn reset' automatically
1108+ rewinds it.
10651109
10661110SEE ALSO
10671111--------
0 commit comments