如何使用git-svn切换svn分支?

Jau*_* Ho 22 svn git git-svn

重复

如何让git-svn使用特定的svn分支作为远程存储库?

我正在使用git-svn跟踪svn上的其他人的开发.我试图弄清楚如何使用gti-svn从一个svn分支切换到另一个svn分支.我能够找到的所有示例都讨论了使用svn开关作为切换位置而不是实际分支的方法.

基本上,我想开始使用svn fetch从/svn/branch/1.3而不是/svn/branch/1.2.

Jes*_*sen 21

当通过git-svn在svn分支上工作时,这些命令对我来说非常有用:

#create local Git branch that mirrors remote svn branch

git checkout -b local/RELEASE-0.12 RELEASE-0.12 
#will connect with a remote svn branch named ‘RELEASE-0.12?

# -n will show which svn branch you will commit into:
git svn dcommit --dry-run 
Run Code Online (Sandbox Code Playgroud)

请参阅我在justaddwater.dk上的文章中的完整说明.

  • 我能够做到这一点,但我的语法不同`git checkout -b branchname origin/branchname` (2认同)

Can*_*der 7

如果您已正确克隆SVN存储库(使用-T -b -t-s),您应该能够使用git branch命令,如:

git reset --hard remotes/branch

git checkout branch
Run Code Online (Sandbox Code Playgroud)

等等