Git:git svn fetch 是如何工作的?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17429442/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git: How does git svn fetch work?
提问by Jacob Krieg
How does git svn fetch
work? Where is that branch which is fetched so that I can merge or rebase with my master or other branch? Where is the data fetched because git remote
doesn't give me anything on my git svn
repository?
如何git svn fetch
工作?获取的那个分支在哪里,以便我可以与我的主分支或其他分支合并或变基?由于git remote
在我的git svn
存储库中没有给我任何东西,所以从哪里获取数据?
采纳答案by Jacob Krieg
This is how git svn fetch
works:
这是git svn fetch
工作原理:
When using git-svn
you don't have remotesof the svnserver as you have when using git, you just have a link to the remote svnserver in your local .gitconfigfile.
当使用git-svn
你没有遥控器的的SVN,你使用的时候有服务器混帐,你只要有一个链接到远程SVN在本地服务器的.gitconfig文件。
If you want to update your current branch to the last revision you can use git svn rebase
. But if your svn project is big you might be in the situation where you don't know if you the last revision is a successful build. And if you want to update to a specific revision that you're sure is a successful build, for example you use Jenkins which gives you the last successful build, you have to first fetchto the revision you want and then rebasewith the fetched commits.
如果要将当前分支更新到最后一个修订版,可以使用git svn rebase
. 但是如果您的 svn 项目很大,您可能会处于不知道上次修订是否成功构建的情况。如果您想更新到您确定构建成功的特定修订版,例如您使用 Jenkins 为您提供最后一次成功构建,您必须首先获取您想要的修订版,然后使用获取的提交变基.
For this you can git svn fetch -r <revision>
. This will fetch locally the commits till the wanted revision. To rebase the fetched data you must use git svn rebase -l
or git svn rebase --local
. You don't have to be online to do a local rebase.
为此,您可以git svn fetch -r <revision>
。这将在本地获取提交,直到所需的修订。要重新设置获取的数据,您必须使用git svn rebase -l
或git svn rebase --local
。您不必在线进行本地变基。
回答by Levi Haskell
By default the git-svn tracking branch is remotes/git-svn
, you can use it to merge or rebase your work on top of the changes fetched by git svn fetch
.
默认情况下,git-svn 跟踪分支是remotes/git-svn
,您可以使用它在git svn fetch
.
回答by Colin D Bennett
The git-svn tool unfortunately doesn't actually make the remote SVN branches into true Git remotes. They look like remotes but they don't actually function as remotes. git-svn tracks the branches internally and I too have found it a bit frustrating.
不幸的是,git-svn 工具实际上并没有使远程 SVN 分支成为真正的 Git 远程分支。它们看起来像遥控器,但实际上并没有遥控器的功能。git-svn 在内部跟踪分支,我也发现它有点令人沮丧。
You can branch from the SVN branches or merge from them, however. Run git branch -r
to see all your remote tracking branches, including those pseudo-branches created by git-svn:
但是,您可以从 SVN 分支分支或从它们合并。运行git branch -r
以查看所有远程跟踪分支,包括那些由 git-svn 创建的伪分支:
$ git branch -r
svn/SVNBranch1
svn/SVNBranch2
$ git checkout -b branch1 svn/SVNBranch1