Reputation: 54830
I am new to git, and have a subversion repository that I want to be able to import into a git repository occasionally (for deployment). So I want to perform most of the updates using svn but wanted to see what's the best way to push it to git (just the default/master branch).
Upvotes: 3
Views: 1137
Reputation: 6585
in a nutshell:
mkdir my_blog_tmp
cd my_blog_tmp
git-svn init http://code.yoursite.net/my_blog/trunk/ --no-metadata
git config svn.authorsfile ~/Desktop/users.txt
git-svn fetch
and congrats for joining us gits! Here is a great cheat sheet for (ex)svn users.
Upvotes: 1
Reputation: 1329952
I know you only want to import the master/trunk branch of your svn repository, but I would like to mention svn2git in order to import your svn into a git repository.
It is better than git svn clone
because if you have this code in svn:
trunk
...
branches
1.x
2.x
tags
1.0.0
1.0.1
1.0.2
1.1.0
2.0.0
git-svn
will go through the commit history to build a new git repo.
It will import all branches and tags as remote svn branches, whereas what you really want is git-native local branches and git tag objects.
So after importing this project, you would get:
$ git branch
* master
$ git branch -a
* master
1.x
2.x
tags/1.0.0
tags/1.0.1
tags/1.0.2
tags/1.1.0
tags/2.0.0
trunk
$ git tag -l
[ empty ]
After svn2git is done with your project, you'll get this instead:
$ git branch
* master
1.x
2.x
$ git tag -l
1.0.0
1.0.1
1.0.2
1.1.0
2.0.0
Finally, it makes sure the HEAD of master is the same as the current trunk of the svn repo.
Upvotes: 5
Reputation: 19259
Why not just work in git on your workstation too? That would be the most straightforward.
git svn clone
will grab your SVN repository and import the revisions into a new git repo. git remote add
will add it for you.git svn dcommit
Upvotes: 3