更新远程分支的 git-svn 列表
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2135601/
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
Update git-svn list of remote branches
提问by Daniel Huckstep
When I have to use svn, I use git-svn to talk to svn. I cloned the repo with the standard git svn clone -s line, and all the remote branches at the time were there.
当我必须使用 svn 时,我使用 git-svn 与 svn 交谈。我用标准的 git svn clone -s 行克隆了 repo,当时所有的远程分支都在那里。
Since then, a new branch has been created, but not by me. I want to checkout/track this branch locally. I can track a branch that I can see (with git branch -r) like so:
从那以后,一个新的分支被创建了,但不是我创建的。我想在本地结帐/跟踪这个分支。我可以跟踪我可以看到的分支(使用 git branch -r),如下所示:
git checkout -t -b dev remotes/development
But this doesn't work with the other branch, since it doesn't show up in git branch -r
但这不适用于另一个分支,因为它没有出现在 git branch -r 中
How can I track this missing branch?
如何跟踪这个丢失的分支?
回答by Greg Bacon
After running the following commands, you'll be able to see the new branch on the git side:
运行以下命令后,您将能够在 git 端看到新分支:
$ git svn fetch
$ git svn rebase
Make sure your branch is clean first.
首先确保你的分支是干净的。
回答by Dan
git svn rebase
will rebase the current branch and all the branches that you have indicated should be automatically fetched in your local repository configuration.
将重新设置当前分支,并且您指定的所有分支都应该在您的本地存储库配置中自动获取。
git svn fetch
will fetch all the branches from the SVN repository as described when you originally did the git svn clone (including new ones). This is in contrast to the behaviour of
将从 SVN 存储库中获取所有分支,如您最初执行 git svn clone 时所述(包括新分支)。这与行为相反
git fetch
which only fetches the branches you've specified, as with the git svn rebase.
它只获取你指定的分支,就像git svn rebase 一样。
This difference is primarily because git can't "see" the SVN remotes branches until they've been pulled into the local repository vs when you clone a git repository and git branch -ashows all the remote branches (even those that aren't tracked/won't be updated with a fetch).
这种差异主要是因为 git 无法“看到”SVN 远程分支,直到它们被拉入本地存储库与克隆 git 存储库和git branch -a显示所有远程分支(即使那些不是跟踪/不会通过获取更新)。
回答by childno?.de
git svn rebase --fetch-all
will tackle it, refer to the man page:
git svn rebase --fetch-all
将解决它,请参阅手册页:
This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it.
[...]
This works similarly to svn update or git pull
[...]
This accepts all options that git svn fetch and git rebase accept. However, --fetch-all only fetches from the current [svn-remote], and not all [svn-remote] definitions.
这会从当前 HEAD 的 SVN 父级获取修订,并将当前(未提交给 SVN)的工作重新绑定到它。
[...]
这类似于 svn update 或 git pull
[...]
这接受 git svn fetch 和 git rebase 接受的所有选项。然而,--fetch-all 只从当前的 [svn-remote] 中获取,而不是所有的 [svn-remote] 定义。
:i: BUT it fetches all svn copies / branches
:i: 但它获取所有 svn 副本/分支