Slashdot Mirror


Practical Reasons To Choose Git Or Subversion?

markmcb writes "I develop Rails applications and recently followed my lemming herd and made the switch to Git after learning some of the practical advantages Git offers over Subversion. As I'm sure there are many die-hard Subversion fans in the Slashdot audience, I'm curious what your key reasons are for sticking with Subversion. If possible, I'd like reasons that apply to 'most of the time' as opposed to arguments based on obscure features that may get used only a few times ever."

19 of 667 comments (clear)

  1. Familiarity? by gorrepati · · Score: 5, Insightful

    Thats all there is it to it, oh mighty one!

    --
    You will never have experience until after you needed it.
  2. Integration in common tools by oever · · Score: 3, Insightful

    Git is not well supported on Windows like Subversion is with turtoiseSVN. There is no good integration in Eclipse or Netbeans. The workflow is more complicated and enterprise tools such as Jira and Confluence do not support it.

    These things may improve but right now, Git is not very well suited for use in corporate environments.

    --
    DNA is the ultimate spaghetti code.
  3. Re:IDE Integration by Tester · · Score: 4, Insightful

    Clearly, you've never used git to think that some UI can make subversion usable.. Try merging a reasonably-sized branch with subversion (and you'll fail and cry and ask why oh why you didnt use git).

  4. Re:my choice by sohp · · Score: 3, Insightful

    I also like the central server aspect, so that there is one place where the code is located, and I just have to keep that backed up.

    Nothing wrong with that, if it's effective for you and your team, and clearly svn wins out over git. Trying to make git within that model is just adding complexity without getting the benefits. If, in the future, you and your team decide you need to change how you do source control, then git, or some other distribute peer-to-peer system, might be the solution. But don't just use it as a drop-in replacement for centralized server development.

  5. Re:go with Perforce by 32771 · · Score: 4, Insightful

    >Note that Perforce is free for open source projects.

    Yeah, so was BitKeeper and that used to really work too.

    --
    Je me souviens.
  6. Re:IDE Integration by Haeleth · · Score: 4, Insightful

    I don't use the command line for my source control. IDE Integration means a lot...

    You feel free to wait around for "integration". The command-line client is already nicely integrated into my IDE, which is the most mature, most stable, and most flexible one in widespread use: Unix.

  7. Re:IDE Integration by Wonko · · Score: 4, Insightful

    Simpler solution: stop merging reasonably-sized branches.

    I know that's not reasonable for every situation, but about 90% of the time I see people doing lots of branching and merging, it's a response to screwed-up organizations or dysfunctional personal relationships.

    I constantly branch and merge even when I am the only one working on a codebase. When branching and merging are so easy why wouldn't you take advantage of it? Of course, it is always possible that I have a dysfunctional relation with myself.

    That's not to say git isn't awesome for certain situations, mind you.

    I can't speak for how awesome git is, I've never used it.

    But branching and merging adds a fair bit of overhead, and anything that increases a project's overhead should be your last resort, not your first.

    If branching is increasing your workload instead of making things easier you are most likely not using a source control system that is good at branching and merging.

  8. Re:IDE Integration by GooberToo · · Score: 3, Insightful

    Branching and merging is a fact of life. If you don't branch or merge, likely your project is either trivial or your pool of developers small. Larger projects with many developers require the ability to branch and merge large bodies of code. Attributing this fact to personalities is nothing but hand waving. Personality conflicts may be the root-cause for you but is not the root for the majority of people that require such functionality.

    Simple fact is, branching and merging is required for complex software development. In part, that's why git was developed in the first place.

  9. Re:My own opinion (prob. very controversial) by Prien715 · · Score: 4, Insightful

    You've obviously never worked on a programming team.

    The best reason to use CVS or Git is the situation where multiple programmers are touching the same file(s) at once and you need to both commit. Also, the blame tool on SVN lets you easily tell when any given line of the code was added and why (see the commit message). The SVN repository I work on professionally has well over 25K commits...try managing that with a bunch of copies and text files!

    (I've done the versioned tarballs for a project I worked on alone...never again!)

    --
    -- Political fascism requires a Fuhrer.
  10. Re:IDE Integration by dubl-u · · Score: 4, Insightful

    I constantly branch and merge even when I am the only one working on a codebase. When branching and merging are so easy why wouldn't you take advantage of it?

    I do, too. I call it "checking out" and "committing". I do it every few hours.

    If branching is increasing your workload instead of making things easier you are most likely not using a source control system that is good at branching and merging.

    When I'm building a unified product, what need would I have of branching and merging? If I'm not sure if something is a good enough idea to build, I don't build it. Or I build a quick, throw-away implementation to check an idea out. And then I throw it away.

    No matter how good a source control system is at branching and merging, it can't solve the real cost: maintaining a understanding of different, semi-incongruent notions of the project, and then resolving those differences. The whole point of branching is to increase complexity, and excess complexity is the enemy of every good software project. As Occam's razor says, you shouldn't multiply entities beyond that which is strictly necessary.

    That's not to say I never branch. But it's always a last resort for me, no matter how awesome the source control system is.

  11. They don't exist by OrangeTide · · Score: 3, Insightful

    There is no such thing as a "die hard" subversion fan. People use subversion because they already use subversion. Not because they are fanatical about their choice. Which sets them apart from people who go for Git, Mercurial, etc. it puts subversion people roughly in the same group as CVS people.

    It's hard to be fanatical about the philosophy of "if it ain't broke, don't fix it"

    --
    “Common sense is not so common.” — Voltaire
  12. Re:IDE Integration by Dhalka226 · · Score: 3, Insightful

    There are a lot of times I don't branch, but it's usually out of laziness and I end up regretting it at some point in the project.

    Easily, the most common reason for branching is a stable-versus-development split. I've run into it in virtually every project I've been on that involved any other people (even just as employer), and even a number of my personal projects. Stable branches almost always need an occasional bugfix or super-quick feature that I can be reasonably sure to get in in a one or two commits, and typically these things need to go out ASAP. I've run into that a million times with copy changes. In programming world, copy changes are usually the lowest possible priority thing, but with clients they're often some of the highest priority.

    Point being, if I'm ever working on adding some major feature--really anything that will take more than a couple days, and sometimes even when it won't--I'm likely going to be better served doing it in a branch. If it happens that I get through it without needing to make any changes to the stable code, sweet! The merge is going to be super quick and easy. If not I'm going to be very glad I took the time to branch or regret not having done so. "I can't make your change right now because I have a ton of half-finished in-development code" is not an excuse people are interested in hearing.

  13. Re:IDE Integration by dubl-u · · Score: 3, Insightful

    Easily, the most common reason for branching is a stable-versus-development split.

    I agree that's popular, but I don't think it's a good idea. Wouldn't it be better to have every check-in be stable?

    I've run into that a million times with copy changes. In programming world, copy changes are usually the lowest possible priority thing, but with clients they're often some of the highest priority.

    Yes, you could solve the problem that way. I normally solve it by releasing frequently. It's pretty rare that people mind waiting a few days. Or if they need to change copy a lot, by putting the copy in a content management system, so they can change it whenever they get the urge.

    I can't make your change right now because I have a ton of half-finished in-development code

    I solve that by not having a ton of half-finished code. Ship early, ship often, I say.

  14. Re:IDE Integration by Abcd1234 · · Score: 4, Insightful

    When I'm building a unified product, what need would I have of branching and merging? If I'm not sure if something is a good enough idea to build, I don't build it. Or I build a quick, throw-away implementation to check an idea out. And then I throw it away.

    So you've never implemented something and then wished you could revert a change that didn't work out? Or have never wanted to incrementally implement something without incorporating it into the final product until it was fully complete? Really?

  15. Re:Exactly. Use a solution for modern problems by Quartz25 · · Score: 3, Insightful

    It should also be noted that Bazaar actually works on Windows. Git does not.

    --
    Most people don't get why the integral of "e to the x" is so funny. Most math majors don't have a sense of humor.
  16. Re:IDE Integration by 2short · · Score: 3, Insightful

    "Honestly, if you've never seen the need to branch-and-merge, you've never worked on a large project. Period."

    You can always tell when someone is making an unfounded claim based on their own narrow experience being all that matters: They say "Period" at the end.

    Some large projects are organized and run in ways that require branching and merging. Some are organized and run in ways that don't. Generally these decisions are mandated by factors that have nothing to with any developers preference about source control or anything else, but are based on the external nature of the project at hand or management decisions or whatever.

    As far as reccomendations:
    I work on a project that does very little branching & merging. We use SVN, and I like it (Tortoise in particular) very much, so I recommend it if you don't need a lot of branching and merging. If you do need a lot of branching and merging, I've heard it's a PITA, so you should check into that. You probably know if you do, or will do, a lot of branching and merging, and you should choose an SVN system based on that, and not worry what anyone else thinks it says about the size of your project or ability to form teams.

  17. Re:Keyword: Herd by jimdread · · Score: 5, Insightful

    I like to use git because I find it easy to make a branch for testing out some new code, and easy to merge the branch into the trunk if I want to keep it. Here are some aliases I wrote that cover pretty much all the git I use. If I decide to change version control systems, I can change the aliases. alias vca='git add .'; alias vcb='git branch'; alias vcc='git commit -a'; alias vcd='git diff'; alias vcm='git merge'; alias vco='git checkout';

    As for choosing between git and subversion, why not try both? It's pretty unlikely that somebody will tell you what you like best. You have to find out for yourself. Considering that they are free software, easy to install, and pretty easy to use, you can try both and see if one of them seems better to you. I tried both, and I chose git. But I don't mind if other people use subversion, RCS, SCCS, or whatever they feel like using.

    Subversion and git have different models. Subversion has a client-server model with the repository accessible by http. Git uses a distributed model, with each user getting their own copy of the repository, and the possibility of merging things from one repository to another. This might make git work better if the users' computers aren't always able to connect to a remote repository.

    Try them both, see which one you prefer.

  18. Re:IDE Integration by musicmaker · · Score: 5, Insightful

    So I guess you've never worked in the real world, where corporate mandates a change that has to go out before EOB same day, or where you are half way through a feature set impl, and management changes the priorities. What do you do with that code then? Or when the CTO ups and quits, and his info has to be yanked from the website in 30 minutes or less.

    Often you need three branches at least, one for dev, one for staging, and one for production. And that's not counting the system rewrite branch that might be bumbling along in the background perpetuated by another developer whose been assigned to fixing all the wrongs in the current system.

    And let's not even start down the path of trying to integrate people's work in subversion who are in a big team when someone has gone three weeks without a commit because they are working on a major new feature. And that's not even starting to talk about database updates and how they have to be applied in the process between co-ordinating developers.

    Then we can talk about the offshore development team who isn't trusted to put changes into the main branch without a peer review from someone onshore.

    And then you get sued by a competitor who accuses you of stealing their code because you hired one of their developers and they have some random bit of proof, so you have to make a new branch to incorporate whatever random changes legal decides are appropriate to mitigate that, that have to be reviewed by an independent third party who takes three weeks to do anything, and you can't just stop development and wait for them.

    And what happens when you have to update the docs that should be in version control too for someone else, particularly manuals for a release that is concurrent with ongoing development, or even historic because something somebody put in the manual six months ago has turned out to be wrong, and they have to be updated for that release that people are still buying.

    Showing product to the client (because that's who really calls the shots, not the product manager) every few hours is just plain impractical. Most people don't want to see updates every few hours, they want a finished product in clear review cycles. They don't have the time to review the entire system every few days let alone every few hours. A full QA cycle for a normal sized product can last a week. Do you just stop development while they do a full QA before a release?

    And let's not even mention bugs that are transient and may only show up six months down the road when more people start using the system, like race conditions which have become apparent in code that was written two years ago and nobody remembers for toffee. What about storage checking - the system was written by someone who thought that storage would never run out, so why check to see if there is enough space on the disk to complete the operation, and the application crashes and is down for a while while some poor sysadmin tries to find more disk space.

    And the application that wasn't maxing out the network until it was deployed at a client with 300 users, and now you have to go back and rework your com model from a year ago. It's not exactly a bug, but you're gonna have to fix it anyway.

    What about a large scale integration with a pre-existing piece of software that might take a month to complete? You can unit test each piece of it sure, but you can't release the whole thing until the integration is totally complete.

    There are SO many reasons you have to have branches in the real world.

    --
    Everyone is living in a personal delusion, just some are more delusional than others.
  19. Re:IDE Integration by Abcd1234 · · Score: 3, Insightful

    Admittedly my code is rarely ever rolled back, but when I do have to it's as easy as choosing the commits included and in that piece of code and removing them.

    Which is non-trivial when multiple people are working on the same codebase. It's the precise reverse of the merge problem. Although I would contend it's actually conceptually harder. It's much easier to look at a pair of changes and merge them, either automatically or manually. But trying to unwind two sets of intertwined changes is not my idea of a fun time.

    I'm not against distributed SCM in anyway, but I will say that from everything I have read distributed SCM does not alleviate the need for manual conflict resolution in anyway shape or form

    I never said it did. What I said was that users of distributed SCMs have discovered that conflicts simply aren't that big of a problem in everyday use.

    Why do you have broken code in your working copy?

    I don't have broken code in my working copy. I have in-progress code in my working branch. Why do I have that? Because the SCM exists to hold my code. It allows me to compare my code against mainline so I can review my changes. It allows me to incrementally update and revert my work as I go along. It allows me to ensure that all my changes are in an SCM which is backed up daily, so that I don't have to worry if my desktop crashes. It allows me to work in multiple locations on the same codebase. In short, it lets me use the SCM to manage my sourcecode, both my in-progress, working efforts, as well as the stable, in-production codebase.

    Besides which, you seem to have this rosey picture that every commit is a good one. Believe it or not, people make mistakes. And when the guy down the hall accidentally breaks the database because his upgrade script is slightly b0rked, I don't want to waste time while they get their shit together.

    And why is anyone committing code that either does not compile or does not pass your unit test suite?

    Because no test suite covers all bases. And because people simply make mistakes.

    Honestly, have you actually developed in the real world?

    Huh? Why revert or delay anything.

    I see you've completely missed the point. Here, let me be more explicit:

    1. Project X has a deadline looming. In project X, management has scheduled features 1, 2, and 3 to be included.
    2. A month before the deadline hits, the developers for feature 3 report that they are behind schedule and that feature 3 will have to be excluded from the release.
    3. ?

    The question is, what do you do at step 3. If you believe that all development should happen in trunk, then the developers now have to find a way to revert all the changes that make up feature 3 (naturally they've been using the SCM to interact amongst themselves). This could be an extremely non-trivial task depending on the complexity of the change.

    Or, if you believe that all major development such as this should happen in branches, then the managers need only decide not to incorporate the changes from feature 3 into trunk.

    And if you've never encountered this situation, I strongly question your experience, as this is pretty typical (just ask Microsoft about how WinFS is going).

    Branch out only the stable code into your release branch.

    Ha ha ha. Okay, now you're just being funny, right? What, you think you can just cherrypick changesets and build a release? Have you never built a large, non-trivial application with multiple developers? Or a database driven application where multiple, interlinked changes need to be made to the schema? Sorry, but the interdependency between changesets means that's just unrealistic in practice. And I've seen it tried... it ain't pretty, to say the least. Just the process of trawling through the changelog to identify all the mods that went into some feature, so that you can revert them, is an absolute frickin' nightmare. And that's ignoring the process of actually revertin