开发者

Git svn - Clone trunk while maintaining path

开发者 https://www.devze.com 2023-04-11 18:01 出处:网络
I am running a local git repository and want to clone the remote SVN trunk. This works fine but the trunk/ part of the folder is left off. The remote repository is too large to just clone or fetch the

I am running a local git repository and want to clone the remote SVN trunk. This works fine but the trunk/ part of the folder is left off. The remote repository is too large to just clone or fetch the whole thing with branches etc.

I need the path correct for our code review tool.

How can I do a git-svn that only clones a certain trunk/branch but keeps the path intact?

/trunk/folders
/branch/folders

Selecting the Trun开发者_开发问答k option has the local path of

folders

I need it to be

trunk/folders


The way I have been doing this is

svn init -T svn://path/to/trunk
svn git fetch

I have also been using the -r option to git fetch to avoid fetching history from all eternity. You can also add back in branches/tags in to .git/config, this is documented in the git-svn manpage.


  1. (Not sure about this but it's the easiest solution) You could just move the directory folders into a new folder trunk. Git won't mind and other tools will find the path you want.
  2. You could do a git svn init svn://path/trunk trunk
  3. Also check the --ignore-patch option of git svn fetch
0

精彩评论

暂无评论...
验证码 换一张
取 消