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.
No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.
# 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 ...
The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.
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 thinks fuze_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:
[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/*
[svn-remote "newer-svn-remote"]
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/*
branches = branches/{fuze_node}/:refs/remotes/*
Note that you have to specify exactly the same branches mapping as in the older svn-remote:
branches = branches/{stage,prod,stage_with_proxy}/ucapi/:refs/remotes/*
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:
[svn-remote "svn"]
reposRoot = https://svn.example.com/repository
uuid = 8a6ef855-a4ab-4527-adea-27b4edd9acb6
branches-maxRev = 0
tags-maxRev = 0
After that git svn fetch
will fetch only necessary revisions.
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