Git-svn: keeping git repo and svn repo in sync

We have a new git repo that runs from the svn repository. The git repo is now the leading repository where further development will be continued. This repo is hosted. Svn repo, on the other hand, will remain as a publication for non-git users. The question is, how do I update the svn repository from git repository from time to time? I read a lot about git-svn and should not use merging, etc. (See Is git-svn dcommit after merging in git dangerous? ), But merging will be performed in the git repository, and we do not want to restrict development in the git repository according to strange rules (for example, only "rebase" is allowed).

So the question is simple: is their best practice how to keep svn repos in sync with the git repository (say, once every two weeks). Is it even possible to safely revert changes from svn to git (if you need to apply a crash fix to the svn repository, so this rarely happens).

Since the new git repository is hosted, the svn-git repository acts as an intermediary in the middle. This repo can be used to flush git merges in git reboxes or so. It is also great for all intermediate git commits passed by SVN as one blob.

+4
source share
2 answers

You can do any merge in your Git repository if you don't rebuild the branch that you are rewriting back to SVN.
Until you rewrite any story in this thread, you can control the Git repo workflow as you wish.

Thus, it would be best practice to minimize the number of branches synchronized with your SVN registry in order to facilitate the management of these "public" branches ("public" branches, both in the visible to all Git users and for all svn).

+1
source

I have a slightly different setup: the SVN repo is not cloned from the Git repository.

My Git repo has basically two branches: master and svn . master synchronizes with the remote open Git repository, svn is connected to the remote SVN repo.

I apply fixation from one side to the other using git cherry-pick and have no problems reloading and merging.

I tried to merge master in svn before, but always ended up endless conflict resolution sessions. When you use cherry picking, life is much easier.

To get svn in my master , I do the following:

First you need to synchronize both branches with their upstream:

 git checkout svn git svn rebase git checkout master git pull 

Then (while on master ):

 gitk svn 

This brings up the gitk window, where I select the commits that need to be passed from svn to master . Then I apply the commits to the remote using git push .

To get the changes from master to svn , I git checkout svn and then run gitk master . Once again, I select the commits to be transmitted, and when this is done, git svn dcommit pushes the commits to the SVN server.

Simple and painless.

+2
source

All Articles