DEV Community

Ben
Ben

Posted on

Why Git instead of SVN

Why corporate choose Git instead of SVN.

The learning curve of GIT is quite longer than SVN. I think it make the team productivity low.

Top comments (38)

Collapse
 
tux0r profile image
tux0r

A lot of Git is driven by the hype around it. Most people and small teams won't need most of Git's features. The one advantage of Git is working on multiple branches; but then again, Mercurial would be a superior choice for that.

"Just use Git because everyone uses Git" - which is the most common excuse - is horrible, leading to a VCS monoculture.

Collapse
 
erebos-manannan profile image
Erebos Manannán

Even just a single person benefits from using a good DVCS system over SVN/similar. SVN etc. are painfully slow, can't deal with branching or even just properly tracking changes, and are in so many other ways obsolete.

However, just picking Git because everyone picks Git is stupid, as is the case with most tools. Mercurial definitely is better for most uses. Then there are special cases (e.g. games etc.) where something like Plastic SCM is better.

The only workable GUI I know for Git is GitKraken, and that's a fairly recent thing. SourceTree supports both, but isn't great on either. TortoiseHG is what I typically use with Mercurial.

The worst thing about Git is that it was written by a kernel programmer, a person who has literally no idea of how human beings function and think, and really didn't care. Most commands in Git are much more confusing than they need to be, whereas Mercurial is trying to work in a predictable and understandable manner.

Just the amount of people who "proudly" present how many aliases they've set up on their machine to make dealing with git more reasonable is a good sign of this. I've never found a need to make a single shell alias to work with Mercurial.

It really terrifies me how many people think using Git from the CLI makes you cool or something, and then because they can't figure out how it works they just do a blind git add -A && git commit -m '...' && git push -f .. and people seriously just use push -f instead of trying to understand what is wrong when they've got 5 heads on a branch that should be merged, or they've not pulled other people's changes.

With a GUI you tend to see exactly what changes have been made, you can view the per-file side-by-side diffs easily to confirm it's what you think it is, commit what you wanted, and then see the different heads easily.

Collapse
 
tux0r profile image
tux0r
Thread Thread
 
erebos-manannan profile image
Erebos Manannán

"Then there are special cases (e.g. games etc.) where something like Plastic SCM is better."

...

Collapse
 
lingam247 profile image
Daniel Selinger

The only workable GUI I know for Git is GitKraken, and that's a fairly recent thing. SourceTree supports both, but isn't great on either. TortoiseHG is what I typically use with Mercurial.

There's also Git-Tower (git-tower.com). But it's Mac/Win only :-(

Collapse
 
victordev92 profile image
Victor Carvalho

"It really terrifies me how many people think using Git from the CLI makes you cool or something[...]"

Perfect point

Thread Thread
 
moopet profile image
Ben Sinclair • Edited

I don't think it's necessarily "cool" but I genuinely have trouble using GUIs for these sort of things.

Collapse
 
balazsbotond profile image
Botond Balázs

I think cheap feature branches are the killer feature of git compared to centralized SCM systems. And those are useful for any team with at least 2 people. Git is also super fast!

Collapse
 
lingam247 profile image
Daniel Selinger

Can't say much about the Mecurial part but you're right about that most - not even small - teams don't need that much of the feature set.

git add, commit, pull, push, branch, status, log and reset from time to time.

Also there are some really nice GUI available.

Collapse
 
imben1109 profile image
Ben • Edited

"Just use Git because everyone uses Git" - which is the most common excuse - is horrible, leading to a VCS monoculture.

Sadly. Need to teach new developer how to use Git. Do you have any suggestion for tutorial?

Collapse
 
balazsbotond profile image
Botond Balázs

The Atlassian Git Tutorial is the best introduction to git I've found.

Collapse
 
tux0r profile image
tux0r

Don't do that. Teach them the magnificent variety instead.

Thread Thread
 
imben1109 profile image
Ben

What do this mean?

Thread Thread
 
tux0r profile image
tux0r

Why do you want to teach Git when you can teach better systems?

Thread Thread
 
imben1109 profile image
Ben

Which is better? As Git is selected by corporate, I need to teach new developer how to use this.

Thread Thread
 
lingam247 profile image
Daniel Selinger

Not exactly a tutorial, but Gihub has some nice Cheatsheets: services.github.com/on-demand/reso...

Thread Thread
 
moyapro profile image
MoYapro

I use learngitbranching.js.org for the beginners to learn the basic commands. With this game they can do so in a few hours on their own. HF.

Collapse
 
yosra_skhiri profile image
Yosra

I learned how to use git from this course in udacity, it's pretty good udacity.com/course/how-to-use-git-...

Collapse
 
perttisoomann profile image
Pert Soomann

From my own experience, and that was 10 years ago, here are some personal thoughts on the subject.

SVN puts hidden subfolder into every subfolder in your project, while Git keeps all the the data it needs in single .git in project root directory. Very annoying when you are trying to upload something with FTP

I also seem to remember SVN always copied all files instead of changes for some reason, so it took a lot more space.

Again I don't know if SVN has changed since, but with Git you could commit on your local all day long, then push changes when you want, and it wouldn't mess things up between you and co-workers, while I believe SVN you had to keep it synced all the time?

While Git workflow can get a bit tricky, you can use common conventions like gitflow, but if your team only needs to share changes between members, you all can just push/pull from master.

As for choosing between Git or Mercurial, if you use a GUI tool like Sourcetree, that can work with both, doesn't matter what engine you use per say, as you won't touch command line.

Collapse
 
elmuerte profile image
Michiel Hendriks

SVN puts hidden subfolder into every subfolder in your project

This hasn't been the case for quite a long time. You now have a single .svn in the root, just like with git.

I also seem to remember SVN always copied all files instead of changes for some reason, so it took a lot more space.

The .svn contains a "pristine" copy of the file in your workspace. This is an exact copy of the file when checked out. It is just one version of the file.

Git on the other hand stores all versions, from the cloned repo. Unlike SVN, GIT compresses the files. For a repo with a few versions it will be smaller, but once the repo grows it will start to consume more space than SVN does.

Again I don't know if SVN has changed since, but with Git you could commit on your local all day long, then push changes when you want, and it wouldn't mess things up between you and co-workers, while I believe SVN you had to keep it synced all the time?

SVN is still centralized, committing is always to the server. You won't mess things up between you and your co-workers unless people are working on the same files.

Collapse
 
perttisoomann profile image
Pert Soomann

Like I said it was quite long time ago, would be surprised if SVN didn't improve. Good to know.

Collapse
 
lingam247 profile image
Daniel Selinger

SVN annoyed me for the exact same reason: folders everywhere... "Git tracks files not folders", isn't that a claim somewhere git-related?

Collapse
 
perttisoomann profile image
Pert Soomann

That might be, I'm pretty sure you can move files from one folder to another outside git CLI (I know there's specific git command for it as well), and git figures out that file was moved and keeps history intact.

Thread Thread
 
lingam247 profile image
Daniel Selinger

Yes, I think the quote I mentioned refers to empty folders which aren't tracked without some trickery like a gitkeep file or something similar.

Collapse
 
alainvanhout profile image
Alain Van Hout • Edited

Despite potentially being more complex, git tends to be more forgiving: you can typically revert inadvertent changes, try things out in lots of branches, fork again from some point in the past, work together with lots of people on the same thing, commit lots of (partly) duplicate things, and it's generally manageable and won't explode in your face.

The important thing about git is that you don't need to use all its advanced features. And IDE support for it ranges from reasonable to excellent, meaning that for a lot of usage it can keep out of your way / just work.

Collapse
 
garwin4j profile image
Garwin Pryce

The benefits of a disconnected/decentralized repository (even in a corporation), easy branching, relatively good conflict resolution out weights any learning curve it may have. Coming from using TFS and SVN in a corporation, there is no way I would go back.

Collapse
 
cbusenbu profile image
Chas Busenburg

Whether you or others like it or not, git is the de facto version control right now, as developers/managers we in some ways have a responsibility to make sure we/ our developers have current skillsets.

Having said that, it doesn't mean that git is better. I love git so I am biased, but that doesn't make SVN bad.

Reasons I like git:

  1. Differentiating between local and remote repositories. I haven't used SVN a ton, but correct me if I am wrong, if a change is made, it must be propagated to the remote machine, and thus to all users. With git, changes are made locally, revising and changing local history is simple. So that commits created are easily made atomic. Then once you are happy with your changes, you push them up to the remote.

  2. Git was built with branching strategies at the forefront, branching and merging for SVN is still pretty wonky.

It all comes down to workflow. For me personally, the way that I think of git is that branching is cheap. It's easy to create branches, it's fast, and I don't need to worry about manually using svn copy or anything like that to have a branch-like structure.

If you need to learn about git, I really like git-scm.com/book/en/v2 it's available online, it's free, and it will really tell you quite a bit of how git is working in the background.

Change for the most part is a slow process, no matter how you look at it. Embrace it! It sounds like this was forced on your team. I would say a good attitude will go a long way to making the change more manageable. Best of luck!

Collapse
 
nbageek profile image
Patrick Minton • Edited

The last time I had to use SVN was about 10 years ago, but I remember that I had merge conflicts that I needed to resolve ALL THE DAMN TIME, and with git I encounter them rarely (when two folks touch the same line). Git just knows how to merge things.

And the learning curve isn’t bad; there are dozens of svn-to-git tutorials. In fact I’d be very wary about the productivity of any developer who has a really hard time learning the basics.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

SVN is really antiquated when it comes to modern development flow. That said, git may not be the answer. It has a lot of features, but they're wrapped up in a garbage command-line interface.

A tool like bzr supports the same modern branching and process but offers a much cleaner command-line. There's less chance to mess up. There's of course fewer features, but as others have said, most teams don't really need git's full feature set.

I also believe that when people say git they often mean GitHub as well. It's that layer of tools on top that make it powerful.

Collapse
 
drhyde profile image
David Cantrell

My experience is that the learning curve at least to start with isn't any different, because day-to-day git use for a developer is practically the same as day-to-day svn use, just the commands are spelled differently. There are only two major differences. First, you need to remember to git push. Second, branching and merging is much easier and you won't have to jump through so many hoops for it to work reliably.

Collapse
 
michelemauro profile image
michelemauro

Mercurial is far easier of GIT, it makes harder to make mistakes, and has a more consistent interface. It's a shame that is not in wider use.

SVN has been far surpassed by distributed VCS, both in features and in ease of use and support. Sometimes it happens.

Collapse
 
solarliner profile image
🇨🇵️ Nathan Graule

Because Git was made for collaborative work "for the 21st century" so to say. Small teams working on different features, each in their own branches, possibly using Gitflow to enforce a convention. SVN is centralized, doesn't really work well with that kind of workflow. Plus, it's decentralized, meaning you can always work locally and then push your changes.

And while that introduces a bunch of stuff more to learn, at the end of the day Git increases productivity by allowing an effective parallelization of work. Besides, this has had a feedback effect where people demanded their developer learn Git, which made Git popular; and now it is so popular that it is used "by default" even for small projects.

Collapse
 
markussitzmann profile image
Markus Sitzmann

The learning curve of GIT is only longer if you are deep in SVN mindset. If you learn a version control software for the first time, GIT is probably even easier than SVN.

Collapse
 
kayis profile image
K

Somehow I leaped over SVN.

Until 2014 I worked in a company that uses CVS. They talked for years about "switching to SVN".

Then I changed company and they were using Git.

Collapse
 
felipperegazio profile image
Felippe Regazio

Nice thoughts, but i have to say despite everything: man, i really like git : )

Collapse
 
rhymes profile image
rhymes

It GitHub was called MercurialHub we would all be using Mercurial right now.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

I haven't really put much thought into other version control solutions. But apparently there are a few. What are they and how is one better. And does everything have to be a tree?