79
trailing slash, so be sure you include one in the
80
argument if that is what you want. If --branches/-b is
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
--ignore-paths=<regex>;;
90
When passed to 'init' or 'clone' this regular expression will
91
be preserved as a config key. See 'fetch' for a description
816
817
------------------------------------------------------------------------
818
# Clone a repo with standard SVN directory layout (like git clone):
814
- git svn clone http://svn.example.com/project --stdlayout
819
+ git svn clone http://svn.example.com/project --stdlayout --prefix svn/
820
# Or, if the repo uses a non-standard directory layout:
816
- git svn clone http://svn.example.com/project -T tr -b branch -t tag
821
+ git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/
822
# View all branches and tags you have cloned:
823
git branch -r
824
# Create a new branch in SVN
825
git svn branch waldo
826
# Reset your master to trunk (or any other branch, replacing 'trunk'
827
# with the appropriate name):
823
- git reset --hard remotes/trunk
828
+ git reset --hard svn/trunk
829
# You may only dcommit to one branch/tag/trunk at a time. The usage
830
# of dcommit/rebase/show-ignore should be the same as above.
831
------------------------------------------------------------------------
839
840
------------------------------------------------------------------------
841
# Do the initial import on a server
837
- ssh server "cd /pub && git svn clone http://svn.example.com/project
842
+ ssh server "cd /pub && git svn clone http://svn.example.com/project [options...]"
843
# Clone locally - make sure the refs/remotes/ space matches the server
844
mkdir project
845
cd project
852
git config --remove-section remote.origin
853
# Create a local branch from one of the branches just fetched
854
git checkout -b master FETCH_HEAD
850
-# Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
851
- git svn init http://svn.example.com/project
855
+# Initialize 'git svn' locally (be sure to use the same URL and
856
+# --stdlayout/-T/-b/-t/--prefix options as were used on server)
857
+ git svn init http://svn.example.com/project [options...]
858
# Pull the latest changes from Subversion
859
git svn rebase
860
------------------------------------------------------------------------
986
branches and tags is required, the options '--trunk' / '--branches' /
987
'--tags' must be used.
988
989
+When using the options for describing the repository layout (--trunk,
990
+--tags, --branches, --stdlayout), please also specify the --prefix
991
+option (e.g. '--prefix=origin/') to cause your SVN-tracking refs to be
992
+placed at refs/remotes/origin/* rather than the default refs/remotes/*.
993
+The former is more compatible with the layout of Git's "regular"
994
+remote-tracking refs (refs/remotes/$remote/*), and may potentially
995
+prevent similarly named SVN branches and Git remotes from clobbering
996
+each other.
997
+
998
When using multiple --branches or --tags, 'git svn' does not automatically
999
handle name collisions (for example, if two branches from different paths have
1000
the same name, or if a branch and a tag have the same name). In these cases,
1057
[svn-remote "huge-project"]
1058
url = http://server.org/svn
1059
fetch = trunk/src:refs/remotes/trunk
1045
- branches = branches/{red,green}/src:refs/remotes/branches/*
1046
- tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
1060
+ branches = branches/{red,green}/src:refs/remotes/project-a/branches/*
1061
+ tags = tags/{1.0,2.0}/src:refs/remotes/project-a/tags/*
1062
------------------------------------------------------------------------
1063
1064
Multiple fetch, branches, and tags keys are supported: