Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use git-svn with an existing repo lacking .git/svn/

Tags:

git

svn

git-svn

I've cloned a project's sources using Git, which is converted on the server from a SVN repo. The problem with this Git repository is that it lacks tags, branches, and some revisions are missing. The number of revisions is enormous (~20000) for me to use git-svn clone, and it'd be a waste of bandwidth and time as I already have most objects in my local repo. Because of this, I'd like to know:

  • How can I convert my Git repository to a git-svn repo to update directly from the SVN repo instead of the broken Git repo.
  • Can I fetch the missing revisions without having to clone everything?
  • Is it possible to download tags with Git directly?
  • Will those branches be an extra problem?
like image 481
moatPylon Avatar asked Jul 08 '10 21:07

moatPylon


People also ask

Can I use git and SVN at the same time?

You can clone a subversion repository to your machine using git svn clone <SVN repo URL> . The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful.

What does git SVN rebase do?

Normally, the "git svn clone" and "git svn rebase" commands attempt to recreate empty directories that are in the Subversion repository. If this option is set to "false", then empty directories will only be created if the "git svn mkdirs" command is run explicitly. If unset, git svn assumes this option to be "true".

What is difference between SVN and git repository?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.

How do I clone a SVN repository?

You can clone from a SVN repo using the git svn clone command. -s = If your SVN repo follows standard naming convention where main source is in “trunk”, branches are created in “branches”. Here we are telling git svn that trunk is the “trunk” directory, maintenance is the “branches” directory etc.


1 Answers

  • Letting git-SVN take over your clone is easy; just run git svn init with the same arguments you used in the original repo and then your git svn fetch should find the existing commits in the repo.

  • Adding the branches can't be done without serious repo surgery: you'd have to rewrite much of your history to include the cross-branch merges.

  • Pulling tags in is easy and I believe can be done after the initial repo clone.

like image 185
Ben Stiglitz Avatar answered Nov 05 '22 07:11

Ben Stiglitz