Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 908
UncleZeiv Avatar asked Feb 09 '11 16:02

UncleZeiv


People also ask

How do you tell which remote branch a local branch is tracking?

1 Answer. There is a command that gives you about all tracking branches. And to know about the pull and push configuration per branch you can use the command git remote show origin. and you can use -sb option for seeing the upstream.

How can you tell the difference between a local and remote repository?

You can git branch -a to list all branches (local and remote) and then choose the branch name from the list (just remove remotes/ from the remote branch name. Example: git diff main origin/main (where "main" is the local main branch and "origin/main" is a remote, namely the origin and main branch.)

What does local branch should track remote branch mean?

Tracking branches are local branches that have a direct relationship to a remote branch. If you're on a tracking branch and type git pull , Git automatically knows which server to fetch from and which branch to merge in.


2 Answers

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

like image 116
Damien Pollet Avatar answered Oct 04 '22 05:10

Damien Pollet


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
        ....
like image 41
seriyPS Avatar answered Oct 04 '22 06:10

seriyPS