简体   繁体   English

如何使用Git SVN fetch获取单个分支?

[英]How do I fetch a single branch using Git SVN fetch?

I am working with the Git SVN plugin with a SVN repository, every timeI do a git fetch it fetches all the branches changes all over SVN repository. 我正在使用带有SVN存储库的Git SVN插件,每次我执行git fetch它都会获取SVN存储库中的所有分支更改。 it takes a long time after couple of hours with many commits over many branches 经过几个小时,许多分支机构的许多提交需要很长时间

Can I tell it to fetch changes only for specific branches? 我可以告诉它仅针对特定分支获取更改吗?

You can fetch the remote branch corresponding to your current HEAD by using git svn fetch --parent . 您可以使用git svn fetch --parent获取与当前HEAD对应的远程分支。

It's not possible to fetch from a single remote Subversion branch that isn't the parent branch, sadly. 遗憾的是,无法从一个不是父分支的远程Subversion分支中获取。 You can kick of a git svn fetch in the background, though; 不过,你可以在背景中git svn fetch一个git svn fetch ; it won't affect your working copy at all. 它根本不会影响你的工作副本。 I have my computer set up to do the fetch automatically overnight using cron . 我的计算机设置为使用cron在一夜之间自动进行提取。

We have experienced the same problem. 我们遇到了同样的问题。 Our solution was (to our great satisfaction) not to use fetch on SVN but to let git import all SVN tags, branches and trunk to git -like structure. 我们的解决方案(令我们非常满意)不使用SVN上的fetch,而是让git将所有SVN标签,分支和主干导入git like结构。

Our SVN repository wasn't even properly created (trunk/tags/branch directories), but it didn't matter. 我们的SVN存储库甚至没有正确创建(主干/标签/分支目录),但没关系。

git svn --tags PATH_TO_YOUR_TAGS --branches PATH_TO_YOUR_BRANCHES --trunk PATH_TO_YOUR_TRUNK svn+ssh://path.to.your.svn/repository

This will take really long time. 这将花费很长时间。 After this, workflow is git -like. 在此之后,工作流程git You commit and make branches like in git , then... 你在git提交并制作分支,然后......

commit to SVN: 提交SVN:

git svn dcommit

checkout from SVN: (in diff) 结账从SVN :(差异)

git svn rebase

git-svn man page git-svn手册页

check these: 检查这些:

git-svn init --ignore-paths=<regex>  
git-svn fetch --ignore-paths=<regex>

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

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