如何判断哪个远程svn分支是本地git分支跟踪?

发布于 2024-10-16 12:55:20 字数 431 浏览 4 评论 0原文

我对如何从不同的本地 git 分支提交多个 svn 分支有点困惑。特别是,尽管我已经阅读了有关该主题的许多相关问题,但到目前为止似乎没有人解释过一件具体的事情:

如果我已经有一些本地分支,我如何知道哪个远程 svn他们正在跟踪的分支(如果有)?

来自 这个答案似乎你可以更改你想要跟踪的分支,但是如何查询它呢?

gitbranch -v 似乎对此没有特别帮助(即没有给出附加信息)。我还查看了 .git/ 中的所有文本文件,但也找不到任何内容。

I'm a bit confused about how to commit on several svn branches from different local git branches. In particular, even though I've read many of the relates questions on this topic, there's one specific thing that nobody seems to have explained so far:

if I already have a few local branches, how can I tell which remote svn branch they are tracking (if any)?

From this answer it seems that you can change the branch you want to be tracking, but how to query it?

git branch -v doesn't seem to be particularly helpful in this (i.e. no additional information is given). I've also looked into all textual files in .git/ but couldn't find anything in there as well.

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

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

发布评论

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

评论(5

执着的年纪 2024-10-23 12:55:20

git svn info 为您提供完整的存储库 URL,因此 SVN 分支应该出现在此处。

git svn info gives you the full repository URL, so the SVN branch should appear there.

一刻暧昧 2024-10-23 12:55:20

不确定,但 .git/config 中的类似内容可能对您有帮助吗?

[svn-remote "some-project"]
        url = http://example.org/svn
        fetch = trunk:refs/remotes/trunk
        branches = branches/{branch1,branch2}:refs/remotes/branches/*
        branches = branches/branch3:refs/remotes/branches/otherbranch3
        ....

Not sure, but may be smth like this in .git/config helps you?

[svn-remote "some-project"]
        url = http://example.org/svn
        fetch = trunk:refs/remotes/trunk
        branches = branches/{branch1,branch2}:refs/remotes/branches/*
        branches = branches/branch3:refs/remotes/branches/otherbranch3
        ....
厌倦 2024-10-23 12:55:20

这并不完全符合您的要求,但您可以使用 git remote show $REMOTE_NAME 获取基本信息,其中 REMOTE_NAME 是 svn 存储库的远程名称。这应该显示大量有关正在发生的事情的信息。

It's not exactly what you asked, but you can get the basic info by using git remote show $REMOTE_NAME where REMOTE_NAME is the name of the remote for your svn repo. This should show a TON of info about what is going where.

孤凫 2024-10-23 12:55:20

现在我正在使用

git svn dcommit -n

我还希望通过“gitbranch-av”或“gitremote-v”等命令以及可能的一些额外标志来查看它。

For now I'm using

git svn dcommit -n

I also would like to see it with commands like "git branch -av" or "git remote -v" plus potentially some extra flag.

愁以何悠 2024-10-23 12:55:20

你可以尝试:

git remote -v

You could try with:

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