I'm using git-svn to work with a svn repo. I don't want the whole repo, sine it contains a lot of legacy, with binaries in it. I'm only tracking some directories.
Here is my current .git/config
, which is working fine.
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[svn-remote "svn"]
url = https://svn.example.com/repository
fetch = trunk/Python:refs/remotes/trunk
branches = branches/{stage,prod,stage_with_proxy}/ucapi/:refs/remotes/*
branches = branches/{active}/Python/:refs/remotes/*
Now I want to add a new branch:
branches = branches/{fuze_node}/:refs/remotes/*
but when doing git svn fetch
the new branch is not visible to git. It acts as if the line is not in the config.
I know this could be done with a new svn-remote, but I would prefer not to take that road.
For every svn-remote git-svn stores the latest fetched revision in
.git/svn/.metadata
file. It never fetches revisions less than that value. That's why it doesn't fetch the branch you've added to config; git-svn thinksfuze_node
branch is already converted.However you can fetch this branch without re-cloning the whole repository once again:
git svn fetch -R newer-svn-remote
to fetch revisions from the added branch.Your config should look like this:
Note that you have to specify exactly the same branches mapping as in the older svn-remote:
That is, refs/remotes/* should still be on the right side of the mappings. Otherwise git-svn fails to detect already converted commits and tries to fetch them once again.
There's actually another way to achieve the same. It involves some manipulations with internal git-svn files though.
You can just add necessary branch to
.git/config
and update.git/svn/.metadata
file, so the latest fetched revision becomes 0:After that
git svn fetch
will fetch only necessary revisions.