@@ -79,8 +79,21 @@ COMMANDS
79
79
trailing slash, so be sure you include one in the
80
80
argument if that is what you want. If --branches/-b is
81
81
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
+
84
97
--ignore-paths=<regex>;;
85
98
When passed to 'init' or 'clone' this regular expression will
86
99
be preserved as a config key. See 'fetch' for a description
@@ -104,8 +117,11 @@ COMMANDS
104
117
'fetch'::
105
118
Fetch unfetched revisions from the Subversion remote we are
106
119
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).
109
125
110
126
--localtime;;
111
127
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
201
217
+
202
218
Like 'git rebase'; this requires that the working tree be clean
203
219
and 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).
204
223
205
224
-l;;
206
225
--local;;
@@ -435,8 +454,8 @@ Any other arguments are passed directly to 'git log'
435
454
specific revision.
436
455
437
456
'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.
440
459
441
460
'reset'::
442
461
Undoes the effects of 'fetch' back to the specified revision.
@@ -449,9 +468,10 @@ Any other arguments are passed directly to 'git log'
449
468
file cannot be ignored forever (with --ignore-paths) the only
450
469
way to repair the repo is to use 'reset'.
451
470
+
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.
455
475
456
476
-r <n>;;
457
477
--revision=<n>;;
@@ -684,7 +704,7 @@ svn-remote.<name>.noMetadata::
684
704
+
685
705
This option can only be used for one-shot imports as 'git svn'
686
706
will 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
688
708
be able to rebuild them.
689
709
+
690
710
The 'git svn log' command will not work on repositories using
@@ -804,16 +824,16 @@ Tracking and contributing to an entire Subversion-managed project
804
824
805
825
------------------------------------------------------------------------
806
826
# 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/
808
828
# 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/
810
830
# View all branches and tags you have cloned:
811
831
git branch -r
812
832
# Create a new branch in SVN
813
833
git svn branch waldo
814
834
# Reset your master to trunk (or any other branch, replacing 'trunk'
815
835
# with the appropriate name):
816
- git reset --hard remotes /trunk
836
+ git reset --hard svn /trunk
817
837
# You may only dcommit to one branch/tag/trunk at a time. The usage
818
838
# of dcommit/rebase/show-ignore should be the same as above.
819
839
------------------------------------------------------------------------
@@ -827,7 +847,7 @@ have each person clone that repository with 'git clone':
827
847
828
848
------------------------------------------------------------------------
829
849
# 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...]"
831
851
# Clone locally - make sure the refs/remotes/ space matches the server
832
852
mkdir project
833
853
cd project
@@ -840,8 +860,9 @@ have each person clone that repository with 'git clone':
840
860
git config --remove-section remote.origin
841
861
# Create a local branch from one of the branches just fetched
842
862
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...]
845
866
# Pull the latest changes from Subversion
846
867
git svn rebase
847
868
------------------------------------------------------------------------
@@ -973,12 +994,22 @@ without giving any repository layout options. If the full history with
973
994
branches and tags is required, the options '--trunk' / '--branches' /
974
995
'--tags' must be used.
975
996
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
+
976
1007
When using multiple --branches or --tags, 'git svn' does not automatically
977
1008
handle name collisions (for example, if two branches from different paths have
978
1009
the same name, or if a branch and a tag have the same name). In these cases,
979
1010
use '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:
982
1013
983
1014
branches = stable/*:refs/remotes/svn/stable/*
984
1015
branches = debug/*:refs/remotes/svn/debug/*
@@ -1006,7 +1037,7 @@ CONFIGURATION
1006
1037
-------------
1007
1038
1008
1039
'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
1010
1041
[remote] sections except 'fetch' keys do not accept glob
1011
1042
arguments; but they are instead handled by the 'branches'
1012
1043
and 'tags' keys. Since some SVN repositories are oddly
@@ -1035,8 +1066,8 @@ comma-separated list of names within braces. For example:
1035
1066
[svn-remote "huge-project"]
1036
1067
url = http://server.org/svn
1037
1068
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/*
1040
1071
------------------------------------------------------------------------
1041
1072
1042
1073
Multiple fetch, branches, and tags keys are supported:
@@ -1060,8 +1091,21 @@ $ git svn branch -d branches/server release-2-3-0
1060
1091
1061
1092
Note that git-svn keeps track of the highest revision in which a branch
1062
1093
or 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.
1065
1109
1066
1110
SEE ALSO
1067
1111
--------
0 commit comments