Reputation: 6583
How can you do a bidirectional synchronization between a GIT repository and a SVN repository? I've seen how you can convert from SVN to GIT, but not much about how you can synchronize smoothly between the two.
The purpose is to save the project in both types of repositories and have them producing/tracking identical content.
As an extra requirement, the SVN repository as the subject does not contain trunk and branches.
Upvotes: 2
Views: 2399
Reputation: 6583
This post - Creating a two way sync between a Github repository and Subversion - looks to be a solution:
Create a git repo on a github server or a bitbucket server. Clone the empty repo. Add a readme-git file and commit on master.
Initially create the svn tracking branch:
git branch --no-track svnsync git checkout svnsync git svn init http://your-svn-server/your-repo # here removed `-s` if the svn repo is not on a standard layout # or use file:///path/to/local/repo git svn fetch # add if needed `--authors-file svn-authors.txt` git reset --hard remotes/git-svn # the post said `remotes/trunk` but it does not look right
git checkout svnsync git svn rebase git checkout master git merge svnsync # add `--allow-unrelated-histories` to the first merge git push origin master
git checkout master git pull origin master git checkout svnsync git svn rebase git merge --no-ff master git commit git svn dcommit
A drawback of the above sequence is that a bogus readme-git file was added so that a non-tracking branch could be pulled. Starting with a git repo that is initially cloned from the svn repo may avoid the problem, I guess.
Upvotes: 4