I migrated our SVN repository to Git and moved it to the central repository. We had quite a few tags and branches, but we were not able to list and get them from the Git client. This was strange because tags and branches seemed to be available on the server.
Using a blog post by Jon Maddox , a blog post from Marc Liyanage and an SO answer from Casey I was able to sew the solution together. Thanks for the help!
Here is what I ended up doing. First I created a file with svn commiters:
local$ svn log svn://server/opt/svn/our_app |grep ^r[0-9] | cut -f2 -d\| |sort |uniq | tee ~/users.txt
alice
bob
eve
local$ vim ~/users.txt
local$ cat ~/users.txt
alice = Alice Malice <alice@malice.doh>
bob = Bob Hope <bob@hope.doh>
eve = Eve Leave <eve@leave.doh>
Then I created a Git repository from our svn repo:
local$ mkdir our_app
local$ cd our_app
local$ git svn init --stdlayout svn://server/opt/svn/our_app
local$ git config svn.authorsfile ~/users.txt
local$ git svn fetch
local$ git svn create-ignore
local$ git commit -m 'added .gitignore, created from svn:ignore'
local$ for remote in `git branch -r`; do git checkout -b $remote $remote; done
, / . , :
local$ ssh server
server$ mkdir /opt/git/our_app.git
server$ cd /opt/git/our_app.git
server$ git --bare init
server$ git config core.sharedrepository 1
server$ git config receive.denyNonFastforwards true
server$ find objects -type d -exec chmod 02770 {} \;
server$ exit
local$ git remote add origin ssh://server/opt/git/our_app.git
local$ git push --mirror
, :
local$ git clone ssh://server/opt/git/our_app.git
local$ cd our_app
local$ git branch -a
* master
remotes/origin/master
remotes/origin/pre-svn-move
remotes/origin/tags/mytag-0.1
remotes/origin/tags/mytag-0.2
remotes/origin/trunk
remotes/origin/mybranch-1
remotes/origin/mybranch-2
:
local$ git checkout -t origin/mybranch-1
local$ git branch
master
* mybranch-1
: , svn: ignore. .
: ebneter tip svn2git , , git -svn . , "git svn create-ignore" svn2git...