4

I have been using subversion for a while now and I am considering learning and switching to GIT, since it seems to be the majority's preference nowadays.

Nevertheless, one of the biggest advantages of GIT (and source of its complexity) is the capability of being decentralized, each person having its own repository and merging repositories whenever needed. I am not interested in this feature, and actually I want to keep everything centralized on a single server, both for projects on which I work alone, as well as projects where multiple people are expected to have the latest sources at all times stored on the same server, with none or a minimal amount of branches/forks.

Considering this, and that currently most of the development is done on Windows with Visual Studio and also some access is needed from Linux using some simple svn commands, is GIT still a good option? would it be worth switching? what other features does GIT offer that would benefit us?

Felko
  • 71
  • 1
  • 4
  • 1
    This is covered in every Git tutorial/book I've read. Yes, it's possible, and it's what is usually done. See http://git-scm.com/book/en/Distributed-Git-Distributed-Workflows – JB Nizet Dec 24 '12 at 15:26
  • The biggest Git advantages are it's worst disadvantages, actually. – bahrep Dec 26 '12 at 12:32

6 Answers6

6

Let me get this straight.

  • You are using Subversion quite successfully.
  • You don't want to use the distributed features in Git.
  • You are using VisualStudio development.

So, why switch to Git?

I know there's a lot of chatter on Git "being better" than Subversion, but most of that are people who really don't know version control. They see many open source projects use Git and assume that if Linux is using Git, it must be better.

I use both Git and Subversion, and find each one has their strengths and weaknesses.

  • Git is great when there is no central repository. Actually, that's your only option.
  • Git is great if you don't want to get into the details of user access. You give key gatekeepers access, and let them figure out who is allowed to submit code changes.
  • Git is good with a pure Agile shop. That is, a shop that has no fixed release schedule or customer commitments. In fact, the true Agile processes were designed with Git in mind.
  • Git is also great when all of your developers are top rated stars. These guys know Git. They share repository access with each other. They test, they integrate, they scheme, they work with each other. They don't need a project manager or a configuration manager which is why I don't get to work with such star teams too often. Thankfully for me, most development teams aren't top tier teams. Otherwise, as a CM, I'd be out of a job.

Git's problems start to show up when you have customer imposed deliverables and release deadlines. Git just doesn't work well with a Continuous Integration environment unless you're on your developers like a mother hen. What happens is that no changes are delivered to the central repository until the end of a release cycle. Then, you're stuck trying to handle incompatibilities, conflicts, and other issues the last few days of a release.

With a centralized repository like Subversion, developers are forced to work together. They make smaller, more incremental changes in their code. With a good Continuous Integration environment, your QA team can pull out intermediate releases and do testing without waiting for a final release.

As a bonus, Subversion has an excellent integration to VisualStudio via AnkhSVN. There's finally a Git Source Code Provider for VisualStudio, but it's dependent upon TortioseGit and to the BASH shell. Meanwhile, AnkhSVN is a completely encapsulated source code provider whose interface is similar as if you were using VisualStudio or TeamFoundation, so VisualStudio developers are quite familiar with it.

So, unless all of your developers want Git, or you plan to use the distributed features of Git, there's really no reason to switch just for the sake of switching.

David W.
  • 105,218
  • 39
  • 216
  • 337
  • i agree and disagree with many of those statements. we work in teams in a very deadline based company and git works great for us. we just make sure that once a feature/fix is out of development we push it. we also commonly push dev branches so other team members can help each other. i will leave my negative thoughts about svn out of this. – xero Dec 24 '12 at 17:16
  • I didn't say Git doesn't work. It just that you must make sure your developers are working on small bits and pushing their work back to the main repository. As a CM, the mother hen bit falls to me. This takes away from my Angry Birds time. There are plenty of development teams that work well with Git and know what they're doing. Unfortunately, they also are the teams that don't need a senior CM specialist, so I don't get to work with them too much. – David W. Dec 24 '12 at 17:33
  • I diasagree with lots of what you said. I've successfully worked with Git and Mercurial in the presence of stringent release deadlines. We have continuous integration and testing using Jenkins with Git in our current project, with no problems. While we had the problem with devs not merging changes until late in the cycle (in a previous project), we do not have that now (different team) - It sounds like a management/best practices problem, blamed on git. – utnapistim Dec 27 '12 at 10:56
  • Your argument about the advantage of SVN (QA access to latest features) applies the same to git. For some reasons to switch to git anyway (even if devs do not want the distributed features), see my answer below. Another reason to switch is seamless distributed backups - if your centralized svn server fails, you are screwed (unless the centralized server has a backup). If you use git, restoring the backup takes all of one `git clone` command. – utnapistim Dec 27 '12 at 10:59
  • I didn't way Git doesn't work with deadlines and fixed release management. I said it adds complexity. I've worked with Git quite successfully in corporate environments, and I've had some notable failures because the developers didn't understand Git or didn't understand what Continuous Improvement means. What we have with the OP is a site that is using Subversion, and seems happy with it. If they move to Git, they'll use it just like Subversion. Plus, this is also a VisualStudio environment which Subversion integrates with quite nicely. What does moving to Git give them? – David W. Dec 27 '12 at 15:22
3

There are 2 main reasons why you probably want to switch away from SVN into Git:

  • Strong branching and merging (which allows you to implement any branching pattern you need)
  • It is much faster than SVN
  • It is distributed too, but it seems it is not one of the things you're looking for

But, as you mentioned, Git caveat is it can't do centralized: ok, you can have a central server, but you need to have a local repo too, so developers need to:

  • Checkin changes
  • Then push changes

Two steps. Normally it won't be an issue, but there are situations where it can be a major reason to stay on SVN.

That being said, and while Git is an excellent option, considering you're basically on Visual Studio... why don't you take a look at www.plasticscm.com (Disclaimer: I do work for this company). We've recently released a feature that allows you to directly push and pull to a git server... just in case you need a mixed approach: http://codicesoftware.blogspot.com/2012/10/direct-pushpull-from-plastic-scm-to-git.html. It can work fully centralized as an option (SVN flavor) but with all the merging power, the graphics and the VStudio integration too.

Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
pablo
  • 6,392
  • 4
  • 42
  • 62
  • 1
    Nice plug (and valid alternative) +1. I am in the mix of other integration tests (RTC - Rational Team Concert - with Git actually), which is why I didn't answer your mail. – VonC Dec 26 '12 at 10:01
  • Thanks VonC! :). Yeah, we implemented the git protocol actually, first step (what is now under beta) is pushing/pulling, next we'll make Plastic able to act as git server too... :) – pablo Dec 26 '12 at 11:41
2

Currently I use Git on Windows with Visual Studio and I like it. However, I learned Git on Linux initially some time ago. Initially, I was running git-svn for one project I worked at that time. Though git-svn does not allow to take advantage of all Git features, it was good enough for me to find my way with Git and convince myself that Git can be useful for our development. Only after that we decided to convert that repository from SVN to Git.

I think the main advantage of Git is that it is flexible enough to accommodate different workflows. Thus you can choose what fits your development team best. Centralized vs distributed is not a choice between two particular workflows, but more among a large spectrum of possible workflows. If you decide to stay with a centralized workflow similar to SVN, there are still some advantages of using Git.

First of all, you commit your changes before merging with the upstream. SVN forces you to do "svn update" before you have a chance to commit your work. It means that if you made a mistake during this merge, you can lose your work. In SVN, you cannot discard your current merge state and redo it again. Also, you cannot ask a more experience person to help with a non-trivial merge unless this person has direct access to the working tree on your computer.

In general, committing and merging makes your history more truthful as it shows what was the actual state on which your change was made and how you resolved the conflict. The downside is that history is no longer linear. With Git, you can preserve linear history by doing "git pull --rebase" (which can be configured to be default), which makes your history linear as it would be with SVN.

The second problem with SVN is when you commit your changes to the central repository, you never know whether someone else made changes in meanwhile. If those changes were made to different files, SVN will accept your ChangeSet. As result, you have a new state in the SVN repository that no one has tested. Usually, changes made to different files do not cause problems, but sometimes they can. For example, one developer changes some function in a C header and all places where it is used, but the other adds new usage of this function in a new code. Thus you can end up with a broken state on your main development branch even if each developer tested his or her changes. Developers may not notice this breakage immediately until someone says "svn update", but at this moment this person is likely to have his/her own changes, so it can be very confusing in some cases.

Another useful Git feature is that it allows you to try some idea without committing anything to trunk. Then if it does not work out, you can discard it and no one will notice. It is not that I like to hide something from others, but I do not want to force other people to merge their work with my experimental stuff, which may be removed at the end. Moreover removing this experimental code becomes problematic as it is intertwined with other changes. So if you use SVN, your only option is not to commit anything while you are working on this feature. However, it leads to a huge patch-bomb at the end, instead of small logical steps, which is either to review and bisect in case of a problem.

BTW, git-bisect can be really useful to fight tricky regressions in your code. If something got broken, it may not be obvious what and why. So you need to find the commit that introduced this problem and git-bisect is the best tool for this work.

Finally, you have just more options to decide how better to handle some situations. For example, members of your core team can push their changes directly to "trunk" (which is usually called as "master" in Git), but you may not want a newly assigned guy to push his changes without any review. So just tell him to push his changes on a separate branch in the same central repository and then email his mentor, who is going to review and merge this changes if they are good. Branches are really cheap in Git, you should not be afraid of using them. When a short-lived topic branch is merged to the upstream, its name is usually removed, so it won't clutter the branch namespace.

user1922076
  • 136
  • 1
1

Considering this, and that currently most of the development is done on Windows with Visual Studio and also some access is needed from Linux using some simple svn commands, is GIT still a good option?

Yes, it is. Git will allow you to use version control as a backup system (commit stuff only locally and publish when you have a complete feature) and for exploratory work (prototype new feature in new branch, if it doesn't work, remove branch).

Git's distributed nature doesn't impede working with a centralized environment, it just doesn't impose it.

would it be worth switching?

In my opinion, yes. I've worked with lots of source control systems, and after switching to distributed (mercurial at that time), the impact on my work was so big that the next time I had to work with SVN for a project, I installed mercurial locally on top of it, for the "local commit" and painless merging capabilities.

what other features does GIT offer that would benefit us?

Branching will allow you to share incomplete work without affecting your whole team. That means you can send your work to a colleague for review, feedback, testing or contributions, without affecting the main branches at all.

Local commits will allow you to work on multiple features at the same time (switching between them as needed, or saving your current work, switching to something else, then comming back, painlessly). They also allow you to use the version control system for backup points (as you can commit anything, regardless if it compiles or the code is clean, tested or reviewed, without affecting everyone else if the code doesn't compile).

For example, I have a code cleanup branch that I work on when I have no other tasks (or am bored, or have a bit of time). I only push it on the server when I cleanup a file, or a module.

(Local) branching also allows you to work on changes that affect the entire codebase (or large portions of it) without having the rest of the team "do nothing until you commit", so that they do not introduce merge conflicts while you synchronize.

There is also another aspect: With SVN, adding incomplete code forces you to place it inside weird #ifdef FEATURE_NAME blocks, so that even if the code is not complete, others can work around half-implemented features. With git, you simply do not need that, because incomplete changes can be held in branches (local or centralized), as you need. This minimizes code cruft.

utnapistim
  • 26,809
  • 3
  • 46
  • 82
0

I am implementing an highly centralized workflow in my enterprise right now, and yes, Git works fine in that setting.
The only issue is to add the proper authentication and authorisation layer needed for the centralized server to allow or deny a git (push/pull/clone) operation.
See "Distributed Version Control Systems and the Enterprise - a Good mix?" for more.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

git is quite flexible. you can use it both in a centralized or decentralized manner. it's really about the workflow. if you want all the devs on the same page, everyone will need to push/pull/fetch regularly. github has a lot of great notification features for alerting people of updates (e.g email and atom feeds). we pay for private repos at my job and i use the feeds quite often.

xero
  • 4,077
  • 22
  • 39