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

4k views Asked by At

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.

5

There are 5 answers

1
Damien Pollet On BEST ANSWER

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

2
Hank Gay On

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.

1
seriyPS On

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
        ....
1
karlphillip On

You could try with:

git remote -v
0
ptitpion On

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.