git-svn在过去的版本中创建分支

EMi*_*ler 8 svn git

我知道如何使用git创建一个svn分支.但是,我可以从过去的修订/提交中做到这一点吗?

EMi*_*ler 11

回答我自己(以及其他任何人) - 不是严格的git-svn,但它有效:

svn copy https://foo.com/svn/bar/trunk/@6635 https://foo.com/svn/bar/branches/mybranch -m 'creating a branch'
# in your git working directory
git svn fetch
git branch -a
Run Code Online (Sandbox Code Playgroud)

您应该remotes/mybranch在该列表中看到,现在创建一个跟踪该远程的本地分支

git checkout -b local_mybranch remotes/mybranch
Run Code Online (Sandbox Code Playgroud)


Jak*_*ski 5

您只需要先切换到该版本即可。这是仅使用git-svn的示例:

git checkout <sha1-of-past-commit>
git svn branch -m "Create branch for v1.2.3 hotfixes" hotfix-1.2.3
git checkout -b hotfix-1.2.3 remotes/hotfix-1.2.3
Run Code Online (Sandbox Code Playgroud)

在Windows 1.9.0.msysgit.0的Git上测试。