How is SVN v 1.8 branching / merging compared to Git?

前端 未结 2 1228
鱼传尺愫
鱼传尺愫 2020-12-24 07:53

I have been using Git for a while now, and have been recently asked why its merging and branching capabilities are better than those of SVN. Years ago, when I used SVN, I fo

相关标签:
2条回答
  • 2020-12-24 08:44

    It's important to understand the model that the Subversion merge engine uses. It's very different from Git.

    Subversion supports two basic types of merges. The first is a 'sync' merge that is done to keep a development (feature/task/topic) branch up to date with trunk. The second is a 'reintegrate' merge that is used to promote finished work to the trunk. So the model is a mainline (trunk) model that supports feature branches and release branches.

    An important limitation is that Subversion does not consider the full DAG when searching merge history to find the right merge base. Merging between directly related (parent-child) branches is well supported, but merges done between branches that are distant ancestors or siblings, with contributions coming in indirectly from other branches, will often give surprising results.

    Subversion merge support is improving over time as you noted. It had no merge tracking at all until 1.5, made huge leaps in 1.8, and the upcoming 1.9 will improve rename/move tracking. There's also talk of 'local shelves' in the future.

    (By the way, I know some of this because I attended the Subversion/Git Live conference last week and the committer who works on the merge engine gave a presentation.)

    Git on the other hand has a very well respected merge engine. It can handle merges of almost any complexity. In fact its only major merge limitation is that it deduces move/renames after the fact. In very complicated refactoring situations it may not pick up everything properly.

    To summarize:

    • Both Subversion and Git will work well in common merge scenarios.
    • Git will handle more complicated merge scenarios more effectively, particularly when merging between branches that don't have a direct parent-child relationship.
    • Both systems have problem with tracking renames/moves during refactoring, although Git probably does a better job in typical cases.
    • Git's merge command are easier to run in simple cases. Both systems can have a steep learning curve if you're doing unusual operations.
    • Git supports related operations like rebasing and merging between repositories that can improve your workflow in some cases.
    • To get the best use out of Subversion, make sure you have 1.8+ server and clients.

    Hope that helps!

    0 讨论(0)
  • 2020-12-24 08:46

    A couple of things spring to mind.

    1. Git supports private branches which AFAIK SVN doesn't.
    2. Git actively supports workflows where one or more members of the team are developing, possibly propitiatory or confidential branches with commits to the version control and collaboration without between sub-team members without "publishing" the work to the rest of the team(s) and without complex ACL controls to lock some of the branches from being accessible to the remainder of the team.
    3. With git and multiple developers you can always recover your repositories, (or the majority of them), complete with history in the event of a failure short of every developers machine being wiped out - with SVN if something happens to the main server/repository then it is all down to your backup policy.

    I am sure that there are many more.

    0 讨论(0)
提交回复
热议问题