git-svn From GitHub To Svn
git-svn From GitHub To Svn
Updating a git mirror of an SVN repository
1. Clone from GitHub
1
2
git clone [github url]
cd repo
2. Check Ref
1
git branch -r
e.g.
1
2
3
origin/HEAD -> origin/feature-jdk17
origin/feature-jdk17
origin/master
Content of .git/config
:
1
2
3
4
5
6
7
8
9
10
11
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://github.com/chiahao/MyProj.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
3. Relate to Svn
1
git svn init [svn url]
will add some content to .git/config
:
1
2
3
4
...
[svn-remote "svn"]
url = https://svn-server/MyProj
fetch = :refs/remotes/git-svn
4. Update Ref
1
2
git update-ref refs/remotes/git-svn refs/remotes/origin/[`master` or other branch name]
git svn rebase
This is the secret sauce! What I’m doing here is updating the HEAD of the git-svn remote
(refs/remotes/git-svn, this is created for you by doing the “git svn init”) to match the HEAD I grabbed from github
(refs/remotes/origin/[master], again this is created for you by doing the “git clone”).
This post is licensed under CC BY 4.0 by the author.