Bradley
Bradley

Reputation: 1724

How can I re-fetch the revisions of a newly specified branch with git-svn

I've fetched a whole repository from SVN up through revision 15000. I realized that I had an extra branch stashed away in a different location. Is there any way to update the .git/config file with the location of this new branch and re-fetch only the revisions pertaining to that branch?

Upvotes: 7

Views: 3159

Answers (2)

Adam Dymitruk
Adam Dymitruk

Reputation: 129526

Assuming this is just another place in the same repository, you can simply specify through the --branch parameter. It will ignore anything that was fetched already.

If it's another SVN repository, you can set up another SVN remote and fetch from there.

Upvotes: 0

jamessan
jamessan

Reputation: 42647

You can add another branches entry to the svn-remote section of your .git/config file. After that, running git svn fetch should pull down the extra revisions.


If I understand correctly, you can force git-svn to rescan older revisions of branches by removing (or changing) the max-branchesRev line from .git/svn/.metadata and running git svn fetch again. If you change the line instead of removing it, then you'll want to set it to a revision earlier than when your branch was created. It'll then re-scan the branches for all revisions after that.


I probably should've gone with git svn reset first instead of messing with .git/svn/.metadata. If the following doesn't work, then I'm out of ideas. :)

# Find the svn revision git knows about that's just previous (or close to)
# the revision which created the branch
$ git svn reset -r $foundSvnRev
$ git svn fetch
$ git reset --hard $remoteBranch

Then you should be able to use git svn as per normal.

Upvotes: 13

Related Questions