Moving from svn to git
November 12, 2013
After nearly two years of tinkering with git, it’s time to pull the plug on my subversion setup. It’s taking too long to push changes because the repos are getting unwieldy. Git works great with the same amount of data, and much quicker to push changes to and from repositories.
# mkdir staging
# cd staging
# git svn init https://svn.domain.tld/reponame/path/ –stdlayout
# cd staging
# git svn init https://svn.domain.tld/reponame/path/ –stdlayout
Now, check out what config git built for you…
# git config –local –list
And populate it…
# git svn fetch
That make take some time to build your setup.
Once complete, check out the branches and then make them local instead of remote…
# git branch -a
# cp -Rf .git/refs/remotes/* .git/refs/heads/
# rm -Rf .git/refs/remotes
# git branch -a
# cp -Rf .git/refs/remotes/* .git/refs/heads/
# rm -Rf .git/refs/remotes
# git branch -a
On your server, create a bare repo
# mkdir /var/git/project.git
# cd /var/git/project.git/
# git –bare init
# cd /var/git/project.git/
# git –bare init
Add it on the local repo and push everything to it.
# git remote add origin ssh://gituser@git.domain.tld/var/git/project.git
# git push –all origin
# git push –all origin
Once complete without errors, you can check your favourite branch out again somewhere else, or use your staging area.
# git clone -b branchname ssh://gituser@git.domain.tld/var/git/project.git
Leave a Reply