I've seen a number of posts recently suggesting that if you have to do team development with an SVN repository, git is a better client than svn:
- a successful workflow with git
- how to use git-svn as the only subversion client you'll ever need
These articles seem to focus on the how, and skimp on the why. Help me convince myself, boss, and peers that there's advantages 开发者_如何学JAVAto using git-svn over the official svn client!
Note: The relative merits of git and svn are well addressed. I'm more concerned in this question with which client to use on a stipulated SVN repository.
For me the major advantages of using git-svn
(and the CVS bridge) are that
- I have all the history locally for browsing and
git-blame
, - I have full version control when offline, e.g. on the train,
- I can take full advantage of the staging area/index to e.g. only stage specific lines,
- I only need to publish changes when I am happy with them (i.e. I experimented with something and it worked out or I have made the history coherent),
- I can easily pass patch series around for review.
As a bonus, git's interfaces to SVN and CVS allowed me to opt-out the arguments if we should switch our CVS repository to subversion (ongoing since 3+ years) or go for something really cool and fancy immediately (ongoing since 2+ years).
You don't really need a management decision on what developers should use. What is used for your central repository might be driven by other arguments anyway (e.g. build, review and testing infrastructure).
For me it's all about the local branches. When it's time to start working on BigNewFeature, I can create a new branch (locally) using git and start working on it, committing each step of the way as I like. Then when someone inevitably interrupts me from working on BigNewFeature and wants me to fix SmallTypo, I can switch to the master branch, fix the typo, then push it to svn. I can go back to my BigNewFeature branch and go on about my business.
These cheap local branches give you a lot of flexibility as a developer that you just don't get when you have to deal with svn branching and merging. I'm not afraid to quickly branch and experiment. Then when I'm happy with the results I can merge whatever I like back into the master and push it to SVN in a set of clean, easy to discern commits.
精彩评论