如何重新创建 git svn 远程跟踪分支?

发布于 2024-09-16 03:34:57 字数 415 浏览 7 评论 0原文

我使用 git 作为 SVN 存储库的接口。现在我已经创建了一个 SVN 分支:

git svn branch my_branch

这在我的 SVN 存储库中创建了目录,并且还创建了一个名为remotes/my_branch 的分支。然后我删除了该远程跟踪分支:

git branch -r -d my_branch

现在该目录仍然存在于 SVN 存储库中,但我似乎找不到恢复远程跟踪分支的方法。有什么想法吗?我尝试

git svn branch my_branch
=> branch test_new_mod_named already exists

使用 git svn Reset 等,但无济于事。

I'm using git as an interface to an SVN repository. Now I've created a SVN branch:

git svn branch my_branch

This created the directory in my SVN repository, and also created a branch called remotes/my_branch. Then I've deleted that remote tracking branch:

git branch -r -d my_branch

Now the directory is still there in the SVN repository, but I can't seem to find a way to get the remote tracking branch back. Any idea? I tried

git svn branch my_branch
=> branch test_new_mod_named already exists

and played around with git svn reset, etc. to no avail.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假面具 2024-09-23 03:34:57

我发现最简单的方法是使用 svn 在 my_branch 中进行提交,然后再执行另一个 git svn fetch

$ git svn branch my_branch
Copying file:///Users/tfnico/svn-repo/website/trunk at 
r14 to file:///Users/tfnico/svn-repo/website/branches/my_branch...

远程分支存在:

$ git branch -a
  master
* trunk
  remotes/my_branch

删除分支:

$ git branch -r -d my_branch
Deleted remote branch my_branch (was d422fbd).

分支消失了。现在尝试 git svn fetch 重新创建它:

$ git svn 获取

没有任何反应,直到有人这样做......

$ svn checkout file:///Users/tfnico/svn-repo/website/branches/my_branch/

并进行提交。瞧:

$ git svn fetch
    M   hotfix.txt
r19 = f7449780fbb653cbcbc09861c0b446d41321e3f5 (refs/remotes/my_branch)
[17:29:33] tfnico:~/sources/git/website/[trunk]>git branch -a
  master
* trunk
  remotes/my_branch

远程分支回来了。

The easiest way I found to be making a commit in my_branch using svn, and then doing another git svn fetch.

$ git svn branch my_branch
Copying file:///Users/tfnico/svn-repo/website/trunk at 
r14 to file:///Users/tfnico/svn-repo/website/branches/my_branch...

Remote branch is there:

$ git branch -a
  master
* trunk
  remotes/my_branch

Delete branch:

$ git branch -r -d my_branch
Deleted remote branch my_branch (was d422fbd).

And branch is gone. Now try a git svn fetch to recreate it:

$ git svn fetch

Nothing happens, until somebody does this...

$ svn checkout file:///Users/tfnico/svn-repo/website/branches/my_branch/

... and makes a commit. Voila:

$ git svn fetch
    M   hotfix.txt
r19 = f7449780fbb653cbcbc09861c0b446d41321e3f5 (refs/remotes/my_branch)
[17:29:33] tfnico:~/sources/git/website/[trunk]>git branch -a
  master
* trunk
  remotes/my_branch

Remote branch is back.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文