18

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.

Community
  • 1
  • 1
UncleZeiv
  • 17,080
  • 6
  • 46
  • 74

5 Answers5

17

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

Damien Pollet
  • 6,067
  • 3
  • 24
  • 26
  • 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. – UncleZeiv Feb 09 '11 at 19:05
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
        ....
seriyPS
  • 6,019
  • 2
  • 22
  • 16
  • 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. – UncleZeiv Feb 09 '11 at 19:16
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.

Hank Gay
  • 65,372
  • 31
  • 148
  • 218
  • 1
    I'm not sure where should I get `$REMOTE_NAME` from... is that the name of the `[svn-remote]` section of `.git/config`? – UncleZeiv Feb 09 '11 at 19:15
  • @UncleZeiv I would imagine (I'm not on `git-svn` at the moment). What do you see when you run `git remote`? – Hank Gay Feb 09 '11 at 19:54
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.

ptitpion
  • 136
  • 4
-4

You could try with:

git remote -v
karlphillip
  • 87,606
  • 33
  • 227
  • 395