git-svn cloning a repo that lives in git but fetches from svn
I am a bit lost on what is the correct workflow for the following scenario.
I’m using an open source project that’s hosted on google code in a subversion repo. I prefer to use git so I’ve used git-svn to clone the svn repo to a git repo.
The original author still commits to the svn repo (yay!) and me and my team commit to the git repo.
I need to be able to
– Clone the git repo (that contains the svn history)
– Configure git so that it can fetch from the svn repository
– configure git-svn so that it fetches from a particular revision number
Note: when you clone the git repo all links to svn are lost.
2 Solutions collect form web for “git-svn cloning a repo that lives in git but fetches from svn”
SubGit could be an option, they promise a bidirectional Git<->SVN mirror that includes all SVN features. Free for open source projects. Sounds interesting, but I haven’t tried this one yet.
Also, GitHub has a bidirectional SVN connector with about the same set of features as SubGit. You can simply check out a Git URL using Subversion, and it works out of the box. This will require a one-time migration from SVN to Git. See also: How to migrate SVN repository with history to a new Git repository?
If neither is an option for you, the safest bet would be probably to
git svn clone for each client separately. If authentication is not part of the URL, you can always deploy a cloned GitSVN working copy to a different machine, but this is about it in terms of workflow… Related: git clone of git-svn tree?
(I am not affiliated with any of the companies listed above.)
ok so I found a way to do this
first add the svn repo to git config file like this
[svn-remote "svn"] url = http://url/to/repo/svn/trunk fetch = :refs/remotes/git-svn
Note: if your git repo is what used to be the trunk make sure you include it in the url
then call git svn fetch with the svn (after the fetch) is the name of the svn-remote and -r832 stands for -r (revision) and 832 is the subversion revision number that we want to start from
git svn fetch svn -r832
After that I called
git svn rebase and rebased all the picks at the end of it I got a message saying that I should probably create a branch due to all the changes that were rebased and I did then I switched to master and merged the changes from that just created branch.
Now I can git svn fetch from that repo 😀
If there is a better/shorter way than this, would be great to hear it 🙂