How to tell which remote svn branch is a local git branch tracking?
Asked Answered
R

5

19

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.

Rewarding answered 9/2, 2011 at 16:56 Comment(0)
C
18

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

Chilpancingo answered 9/2, 2011 at 18:3 Comment(1)
Yes, this seems to be an important step in the right direction; this is the first command that explicitly states which branch you are going to affect with dcommit basically. If no one finds a command that shows this information all at once for all local branches, I'll probably accept this answer.Rewarding
B
2

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
        ....
Brooklet answered 9/2, 2011 at 17:55 Comment(1)
Thanks but no, it doesn't. I have a generic branches = branches/*:refs/remotes/branches/* line, and no local git branch is mentioned, let alone what the relationship between local branches and remote svn branches is.Rewarding
V
1

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.

Villosity answered 9/2, 2011 at 17:13 Comment(2)
I'm not sure where should I get $REMOTE_NAME from... is that the name of the [svn-remote] section of .git/config?Rewarding
@Rewarding I would imagine (I'm not on git-svn at the moment). What do you see when you run git remote?Villosity
G
0

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.

Greenwood answered 30/5, 2017 at 9:48 Comment(0)
R
-4

You could try with:

git remote -v
Rolon answered 9/2, 2011 at 18:4 Comment(1)
this is not useful when the remote server is svn instead of git.Juanajuanita

© 2022 - 2024 — McMap. All rights reserved.