Skip to content

Commit ea4f836

Browse files
author
James
committed
Adding README and license information.
1 parent 635c136 commit ea4f836

File tree

2 files changed

+107
-0
lines changed

2 files changed

+107
-0
lines changed

MIT-LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2008 James Coglan
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
20+

README

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
== svn2git
2+
3+
+svn2git+ is a tiny utility for migrating projects from Subversion to Git while keeping
4+
the trunk, branches and tags where they should be. It uses git-svn to clone an svn repository
5+
and does some clean-up to make sure branches and tags are imported in a meaningful way, and
6+
that the code checked into master ends up being what's currently in your svn trunk rather
7+
than whichever svn branch your last commit was in.
8+
9+
=== Examples
10+
11+
Say I have this code in svn:
12+
13+
trunk
14+
...
15+
branches
16+
1.x
17+
2.x
18+
tags
19+
1.0.0
20+
1.0.1
21+
1.0.2
22+
1.1.0
23+
2.0.0
24+
25+
git-svn will go through the commit history to build a new git repo. It will import all branches
26+
and tags as remote svn branches, whereas what you really want is git-native local branches and
27+
git tag objects. So after importing this project I'll get:
28+
29+
$ git branch
30+
* master
31+
$ git branch -a
32+
* master
33+
1.x
34+
2.x
35+
tags/1.0.0
36+
tags/1.0.1
37+
tags/1.0.2
38+
tags/1.1.0
39+
tags/2.0.0
40+
trunk
41+
$ git tag -l
42+
[ empty ]
43+
44+
After svn2git is done with your project, you'll get this instead:
45+
46+
$ git branch
47+
* master
48+
1.x
49+
2.x
50+
$ git tag -l
51+
1.0.0
52+
1.0.1
53+
1.0.2
54+
1.1.0
55+
2.0.0
56+
57+
Finally, it makes sure the HEAD of master is the same as the current trunk of the svn repo.
58+
59+
=== Installation
60+
61+
Make sure you have git installed, then install the gem:
62+
63+
$ sudo apt-get install git-core git-svn
64+
$ sudo gem install svn2git
65+
66+
=== Usage
67+
68+
To create a git repo from an existing svn repo:
69+
70+
$ svn2git http://svn.yoursite.com/path/to/repo
71+
72+
This will create a new directory called +repo+ containing the git version of the repository.
73+
If you're not using the standard trunk/branches/tags layout, you can pass arguments to tell
74+
git-svn what to look for:
75+
76+
$ svn2git http://svn.yoursite.com/path/to/repo trunk=the_trunk tags=taggings
77+
78+
=== GitHub integration
79+
80+
When creating your new git repo, svn2git can push your new repo to github.com if you pass
81+
in your username and project name. For example:
82+
83+
$ svn2git http://svn.jcoglan.com/packr github=jcoglan/packr
84+
85+
You need to make sure the project exists on github before running this, and make sure you
86+
have your SSH key set up or this won't work.
87+

0 commit comments

Comments
 (0)