简体   繁体   English

如何使用Git签出SVN标签?

[英]How Do I Checkout an SVN Tag with Git?

I see lots of information about how to sync a git branch and an SVN branch, but I don't know how to check out an SVN tag in git. 我看到了很多有关如何同步git分支和SVN分支的信息,但是我不知道如何在git中签出SVN标签。

I had hoped that I could maintain a demo branch in SVN that was always ready for unplanned customer demonstrations. 我曾希望我可以在SVN中维护一个demo分支,该分支随时可以为计划外的客户演示做准备。 I found out the hard way this morning that repeatedly merging from master to the demo branch won't work. 我发现今天早上很难从master到demo分支反复合并是行不通的。 (See https://stackoverflow.com/a/14173021/2596664 .) I decided to try using svn copy to create tags called demo1 , demo2 , etc instead. (见https://stackoverflow.com/a/14173021/2596664 。)我决定用尽量svn copy创建标签名为demo1demo2等来代替。 Now I don't know how to access those tags from git. 现在我不知道如何从git访问那些标签。 I told git I've used the standard SVN layout, but cannot find any information about how to access the tags part of SVN. 我告诉git我使用了标准的SVN布局,但是找不到有关如何访问SVN的tags部分的任何信息。 How do I access it? 如何访问? If there's a better way to meet my requirement for "a demo branch in SVN that was always ready for unplanned customer demonstrations," I'd love to hear about it. 如果有更好的方法可以满足我对“ SVN中的demo分支始终准备好进行计划外的客户演示”的要求,那么我很乐意听到这一消息。

git-svn will translate SVN tags into Git tags for you, so long as you gave it the correct tags directory. git-svn会为您将SVN标签转换为Git标签,只要您给它正确的标签目录即可。 Usually this is done with git svn init --tags=project/tags (assuming your project is laid out like that). 通常,这是通过git svn init --tags=project/tags (假设您的项目是这样布置的)。 The SVN tags will then be available as git tags. SVN标签将以git标签的形式提供。 There's various options to git svn init to describe your SVN repository layout. git svn init多种选项来描述您的SVN信息库布局。 If those weren't set up correctly, things aren't going to work. 如果这些设置不正确,则将无法正常工作。

You create tags in SVN from the git side using git svn tag tagname . 您可以使用git svn tag tagname从git端在SVN中创建标签。

You can look at what idea git-svn has about your SVN repository layout in .git/config . 您可以在.git/config查看git-svn对SVN存储库布局有什么想法。 Look for something like this: 寻找这样的东西:

[svn-remote "project-a"]
    url = http://server.org/svn
    fetch = trunk/project-a:refs/remotes/project-a/trunk
    branches = branches/*/project-a:refs/remotes/project-a/branches/*
    tags = tags/*/project-a:refs/remotes/project-a/tags/*

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM