简体   繁体   中英

Preserve SVN history of copied TAG when 'git svn clone'ing

I am migrating some SVN projects to git.

I want to clone a certain tag to its own git repository.

By doing a git svn clone on the TAG path I loose all the history that happened before the svn copy, that created the tag in the first place.

Is there a way to preserve the original history in the new git project? (I can browse the SVN history in the IDE of my choice, so SVN seems to be able to provide the needed information)

Reminder: I do NOT want a trunk project with branches and tags resembling the SVN structure. I want a separate project with just the TAG and all the history attached (including revisions before the tag creation)

check the --follow-parent flag:

 git svn clone --follow-parent https://path.to/svnroot/repo/tags/0.12

EDIT:

note however, that git svn will only ever see content that is within the context of the cloned directory; svn-tagging usually involves copying one directory to another location, so you need the entire directory tree (containing both the "trunk" and the final "tagX" director) in order to have enough context for git to work. the reason for this is, that git will refuse to copy anything from/to a path outside the git-repository itself (which makes sense). svn can see the entire history, since it really has the full context (on the server, even if you only have a partial checkout on your local machine)

so, in order to have the full history into your git svn clone, you will probably indeed need to clone the entire project (that is, at least the directory that contains both the trunk and the tag-dir).

so the way to proceed would be:

  • do a full git svn clone of your svn repository, with specifying the trunk/tags/branches directories ( --trunk , --tags and --branches flags if you have some special setup or use --stdlayout if your repo is organized in the standard /trunk, /tags/..., /branches/... way)

  • this will give you a git repository with a number of git branches and git tags, where you can remove all the branches/tags you don't want (or just don't push them to a server)

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