Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update git-svn list of remote branches

When I have to use svn, I use git-svn to talk to svn. I cloned the repo with the standard git svn clone -s line, and all the remote branches at the time were there.

Since then, a new branch has been created, but not by me. I want to checkout/track this branch locally. I can track a branch that I can see (with git branch -r) like so:

git checkout -t -b dev remotes/development 

But this doesn't work with the other branch, since it doesn't show up in git branch -r

How can I track this missing branch?

like image 386
Daniel Huckstep Avatar asked Jan 25 '10 21:01

Daniel Huckstep


People also ask

How do I update remote branch?

Use git push -f to force update the remote branch, overwriting it using the local branch's changes.

What is git SVN fetch?

DESCRIPTION. git svn is a simple conduit for changesets between Subversion and Git. It provides a bidirectional flow of changes between a Subversion and a Git repository. git svn can track a standard Subversion repository, following the common "trunk/branches/tags" layout, with the --stdlayout option.


2 Answers

After running the following commands, you'll be able to see the new branch on the git side:

$ git svn fetch $ git svn rebase 

Make sure your branch is clean first.

like image 73
Greg Bacon Avatar answered Oct 05 '22 13:10

Greg Bacon


git svn rebase 

will rebase the current branch and all the branches that you have indicated should be automatically fetched in your local repository configuration.

git svn fetch 

will fetch all the branches from the SVN repository as described when you originally did the git svn clone (including new ones). This is in contrast to the behaviour of

git fetch 

which only fetches the branches you've specified, as with the git svn rebase.

This difference is primarily because git can't "see" the SVN remotes branches until they've been pulled into the local repository vs when you clone a git repository and git branch -a shows all the remote branches (even those that aren't tracked/won't be updated with a fetch).

like image 23
Dan Avatar answered Oct 05 '22 15:10

Dan