Add svn-repo as branch to git

1

I have a git repo, but my boss wants to see the code in an SVN incl. commit-messages.

Is there a way to add the SVN to git as a branch (like boss-branch), so that I can work with my own branches, merge to boss-branch and do a svn-commit?

Thanks & Greetings, Tobi

Tobi

Posted 2012-01-12T09:45:37.347

Reputation: 154

Answers

1

If you need to keep the SVN repository and you can't migrate from it (which is what it sounds like), then no: you can't have two different repositories represented in your single repository.

What you need instead is a combination of git-svn updated separately.

  1. create your git svn clone in a separate directory ("directory1")
  2. keep your git-based project in its own repository ("directory2")
  3. in your git repo ("directory2"), pull from the svn-clone in directory1 into whatever branch you want (which is easy to get wrong, so do be careful there if you're not heavily familiar with git).
  4. make any changes you want in directory2
  5. pull them back into directory1 using 'git pull'
  6. git svn dcommit from directory1 to push them back

This process is easy to get wrong, especially when using the master branch on the git svn clone and a boss-branch in the regular process, so be sure to run some test cases first.

Wes Hardaker

Posted 2012-01-12T09:45:37.347

Reputation: 1 796