简体   繁体   中英

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.

I had hoped that I could maintain a demo branch in SVN that was always ready for unplanned customer demonstrations. I found out the hard way this morning that repeatedly merging from master to the demo branch won't work. (See https://stackoverflow.com/a/14173021/2596664 .) I decided to try using svn copy to create tags called demo1 , demo2 , etc instead. Now I don't know how to access those tags from 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. 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.

git-svn will translate SVN tags into Git tags for you, so long as you gave it the correct tags directory. Usually this is done with git svn init --tags=project/tags (assuming your project is laid out like that). The SVN tags will then be available as git tags. There's various options to git svn init to describe your SVN repository layout. 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 .

You can look at what idea git-svn has about your SVN repository layout in .git/config . 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/*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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