I am trying to use Git as a frontend to a SVN repository in order to be able to use Git's nice features like simple branching, stashing etc.
The problem is that the SVN repository is quite large (8,000 revs) and contains lots of branches and tags (old as well as new).
It's a near standard layout, with a config containing fetch, branches and tags directives.
Since the oldest branch and tag refers to revision 10, it means that every svn fetch
reads the entire repository history from revision 10 and forward, which can takes hours on the slow connection.
If I only track trunk, then it's fine, but I still want to make git aware of new branches and tags.
I usually look at git log -1
on the branch I'm at and gets the SVN revision from the comment, so I can do git svn fetch -r7915:HEAD
or similar. I guess that's what git svn fetch --parent
does. But why do I need to do this?
I'm on Windows, and use TortoiseGit which has quite nice support for git-svn
, but since TortoiseGit only runs git svn fetch
I'm kind of stuck.
Am I doing something wrong? I expect svn fetch
to be a fast operation when the first svn clone -s
is complete.
git works perfectly fine with a svn repository on the other side, why not benefit from that? Certainly possible, and a fair move towards your colleagues, not to push unfinished changes. however there is one huge danger hidden in there: you will tend to make very few commits to the companies repository.
SVN has a Centralized Model. In git every user has their own copy of code on their local like their own branch. In SVN there is central repository has working copy that also make changes and committed in central repository. In git we do not required any Network to perform git operation.
To change your repo's default branch for merging new pull requests, you need at least two branches. If there's only one branch, it's already the default. You must create a second branch to change the default. This procedure might require you to Set Git repository permissions.
Thanks for the answers. They did not really help me, though.
This command is the best solution so far:
git svn log --all -1 | \ sed -n '2s/r\\([0-9]*\\).*/\\1/p' | \ xargs --replace=from git svn fetch -r from:HEAD
It uses git svn log --all
to find the highest SVN revision number fetched so far, and fetches everything from that point onwards.
I wish git svn fetch
would have an option to behave like this. Unless the SVN revisions are changed, there is no reason git svn
should fetch the same revisions over and over each time.
If you do not need to have full history in the git repository, I recommend you take a look at the "git + svn" approach, detailed in the link below, instead of the standard git-svn integration. Your initial import into git should be very quick, since you will not be importing history.
Make sure to read the section entitled "Benefits, Drawbacks, and Lessons Learned".
http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx
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