Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 890
Bradley Avatar asked Jun 29 '10 17:06

Bradley


People also ask

What does Git SVN fetch do?

This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches :) You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.

How do I clone a branch in SVN?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

Can you use Git with SVN?

The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

What is the difference between Git and SVN?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.


1 Answers

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.

like image 103
jamessan Avatar answered Nov 12 '22 03:11

jamessan