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.
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.
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.)
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.
git svn info
gives you the full repository URL, so the SVN branch should appear there.
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
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With