DEV Community

Cover image for 8 Reasons Why Git is so Popular
Tobias Günther for Tower

Posted on • Originally published at git-tower.com

8 Reasons Why Git is so Popular

When it comes to version control, everybody is talking about Git these days. But because it has become a standard, it's often adapted blindly - without knowing why exactly Git is superior to other systems like Subversion, Mercurial, or CVS. Even if you're already using Git, I think it's good to understand what makes Git great.

Read on for some hard (and soft) facts about why Git has become so popular.


1. Save Time

Imagine that, every time before moving your mouse, you’d have to wait for 5 seconds. Pretty annoying, right? With version control it’s quite the same – we’re also only talking about a few seconds per command, but it quickly adds up in your work day. Git, however, is lightning fast. Use your time for something more useful than waiting for your version control system to get back to you.

git_performance


2. Work Offline

What if you want to work while you’re on the move? With a centralized VCS like Subversion or CVS, you’re stranded if you’re not connected to the central repository. With Git, almost everything is possible simply on your local machine: make a commit, browse your project’s complete history, merge or create branches… Git lets you decide where and when you want to work.


3. Undo Mistakes

diagrams-illustrations.004

Sometimes I make mistakes (it was a shocking discovery for me, too!). What I love about Git is that there’s a little “undo” command for almost every situation. Correct your last commit because you forgot to include that small change. Revert a whole commit because that feature isn’t necessary, anymore. And when the going gets tough you can even restore “deleted” commits with the Reflog – because, behind the scenes, Git rarely really deletes anything. This is peace of mind.

If you want to learn how to undo your mistakes with Git, take a look at the free First Aid Kit for Git, a series of short videos that teach you how to save your neck using Git.


4. Sleep Easy

Have you ever smashed a Subversion repository? I have (and I say this with the associated headache still in vivid memory…). With Git, I can be totally confident because every clone that someone on the team has on their machine is a usable backup. Additionally, almost every action in Git only adds data (deleting is very rare). That makes it pretty hard to really screw things up. And this is a good feeling.


5. Make Useful Commits

diagrams-illustrations.003

There are (at least) two problems when throwing milk, ice cream, and a tomato into a blender. First, after switching it on, no one can tell what you actually put in from looking at this mess. And second, you can’t “roll back” the tomato. The same holds true if you commit a bunch of unrelated changes (a little bit of feature A, something from feature B, a nice little bugfix, …). It’s hard for your teammates to understand what happened and they cannot easily roll back feature A if it causes problems. Git helps you to avoid this mess and create granular commits. With its unique “staging area” concept you can determine exactly which changes shall be included in your next commits, even down to single lines. This is where version control starts to be useful.


6. Work in Your Own Way

When working with Git you can use your very own workflow. One that feels good for you. You don’t have to be a code acrobat to qualify for using Git. Of course, you can connect with multiple remote repositories, rebase instead of merge, and work with submodules when you need it. But you can just as easily work with one central remote repository like in Subversion. All the other advantages remain – regardless of your workflow.


7. Don’t Mix Things Up

diagrams-illustrations.002

Separation of concerns is paramount to keeping track of things. While you’re working on feature A, nothing (and no-one) else should be affected by your unfinished code. What if it turns out the feature isn’t necessary anymore? Or if, after 10 commits, you notice that you took the completely wrong approach? Branching is the answer for these problems. And while other version control systems also know branches, Git is the only one to make it work as it should: fast & easy.


8. Go With the Flow

Only dead fish swim with the stream. And sometimes, clever developers do, too. Git is used by more and more well-known companies and Open Source projects: Ruby On Rails, jQuery, Perl, Debian, the Linux Kernel and many more. A large community often is an advantage by itself because an ecosystem evolves around the system. From code hosting platforms like GitHub and GitLab, to GUI tools like Tower all the way to tutorials and documentation: everything you need is already there!


Take Your Git Skills to the Next Level

Git can add tremendous value to your development workflow. But only if you go beyond the basic "commit, pull, push"!

There are lots of free tutorials on Git available - you only have to invest a bit of your time to become a better developer.

Top comments (10)

Collapse
 
katafrakt profile image
Paweł Świątkowski

Aside from point 1 it seems that you are mostly comparing Git to Subversion. How about, say, Mercurial? I haven't used it in years, but I think it could easily fulfill points 2-8 too.

Collapse
 
gntr profile image
Tobias Günther

Good point, Pawel! Mercurial is indeed one of the other great, modern alternatives. But still there are quite some differences: e.g. in how things like the Staging Area, Stash, and Branching model work in detail.

And maybe most importantly: the ecosystem. All the tools and services around Git give it a considerable advantage, even outside of its actual implementation.

Collapse
 
ac000 profile image
Andrew Clayton

Having had to use Mercurial in the past, it's just weird. It's as if it didn't know if it wanted to be git or just a better svn...

Thread Thread
 
gntr profile image
Tobias Günther

Yeah, I understand what you mean. Git had taken (and risked) a fresh approach in many more ways, I think. With the disadvantage of introducing a steeper learning curve. But, in my opinion, it's absolutely worth it!

Thread Thread
 
ac000 profile image
Andrew Clayton

Maybe my comment wasn't clear. I was referring to Mercurial as weird.

Before using Git I had used BitKeeper (with the Linux kernel source. BitKeeper's use by some of the kernel hackers, including Linus, was always controversial due its license and non-compete clauses and its use eventually became untenable, Andrew Tridgell's infamous LCA talk being the straw that broke the camels proverbial back and Larry McVoy basically saying, guys, you need to find some other solution... that other solution was Git) and of course Git was partly influenced by Bitkeeper. So yes, I've been a happy Git user for > 10 years...

Collapse
 
elmuerte profile image
Michiel Hendriks
  1. Sleep Easy Have you ever smashed a Subversion repository?

In the 16 years I have used (and administered) subversion. This has never ever happened to me. (I have fubar'ed up my local git clone once though, and even have lost a bunch of hours of work.)

Collapse
 
firozansari profile image
Firoz Ansari • Edited

⁣0. Free and Open Source

Collapse
 
katafrakt profile image
Paweł Świątkowski

Many more version control systems are actually free and open source.

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

What I love about git is how hackable it is. There's lots of things that you shouldn't normally do but sometimes become necessary and git lets you do all those things.

Collapse
 
akashkava profile image
Akash Kava

I think the only reason I liked git was being able to investigate and compare changes to lines instead of whole files. The only problem is crlf, windows users have little issue with it.