Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to share the git svn configuration?

Tags:

git

git-svn

So I set up a git-svn repo and pushed it to github. But if one clones it there is no svn config in the clone.
The diff between the repository I pushed and the one I cloned from github just after I pushed is :

enter image description here

The one I pushed (the svn clone with the svn info) is on the right - the clone from github is on the left
Which of those (folders/files (or config sections)) should I share to have people setup git-svn as I have ? In the sense that they clone and then copy paste those files (and possibly run git svn rebase) and they have the same setup as I have. I have cloned all the branches and tags of the svn repo as remote branches also and I would like to share those too. Ideally those files should still be valid even after I (we) start pushing/dcommiting between the git and svn repo

like image 741
Mr_and_Mrs_D Avatar asked Nov 03 '22 17:11

Mr_and_Mrs_D


1 Answers

This seems to work for me:

git clone your-existing-git-repo new-cloned-repo
cd new-cloned-repo
git fetch origin refs/remotes/*:refs/remotes/*
git init
git svn init -s "svn://your-svn-server/your-svn-repo/your-svn-project"
git svn fetch
git checkout master
git svn rebase

While the above works, I have found the below makes a repo with a .git/config file that is identical to my original (no origin remote attachment to master branch).

mkdir new-cloned-repo
cd new-cloned-repo
git init --bare .git
git remote add backup your-existing-git-repo
git fetch backup refs/remotes/*:refs/remotes/*
git fetch backup refs/heads/*:refs/heads/*
git fetch backup refs/tags/*:refs/tags/*
git init

# update SVN references
git svn init -s "svn://your-svn-server/your-svn-repo/your-svn-project"
git config svn.authorsfile your-authors-file.txt
git svn fetch

git checkout master
git svn rebase
git svn show-ignore >> .git/info/exclude

This should clone all Git commits git clone/git fetch and remote branches (all SVN branches/tags that your existing repo knows about) git fetch origin refs/remotes/*, update the SVN connection info git svn init and then update the SVN revision to Git commit mappings via the git svn fetch.

The git svn init -s assumes you are storing stuff in the normal SVN way under your-svn-project (trunk, branches/*, tags/*).

I'm not sure if the git init is needed, but I am sure that it doesn't harm anything if it isn't needed. Also, the git checkout master is likely redundant, but harms nothing.

like image 75
Shadow Man Avatar answered Nov 15 '22 04:11

Shadow Man