Search code examples
gitgit-svn

Re-establishing a git svn clone on a separate machine


I've got a git repository cloned from an external SVN repository through git svn clone. On a separate machine, I'd like to get this clone set up again, so I can update the git repository with recent SVN changes. How do I do this?

It seems using git svn clone or git svn init creates an empty repository, and git svn fetch uses a predefined URL. I don't want to have to reset my Git repository - I just want to pull the existing remote, re-link it to the same SVN, and continue with the git svn rebase to update Git with recent SVN changes.


Solution

  • You can re-establish a git svn clone just by running the same commands you used to initialise the remote Git in the first place (but you might need to ensure you use the same --prefix in the git svn clone). It looks like Git keeps track of SVN metadata in the Git commit messages (git-svn-id:) to prevent duplicates.

    That is:

    1. git svn clone -s https://openclerk.googlecode.com/svn/ openclerk -A svn-authors.txt --prefix "" (the empty prefix is because the original Git repository used an empty prefix too)
    2. git remote add origin https://github.com/soundasleep/openclerk.git
    3. git branch --set-upstream-to=origin/master master
    4. git pull
    5. Carry on with git push, git svn rebase, git svn dcommit as necessary