Jun 26 2016

The Subversion Users guide to Git: Part 1

Introduction

For the record, I LOVE subversion.  Because I have been a solo developer and a developer on a very small team for a long time, part of me is unsure what all the hubbub is with Git.

But I have accepted the fact that Distributed Version Control (DVCS) and Git are the future.  Rather than resist I have decided to get on board (no pun intended.)

This guide is more about logging what I learn so you should know two things up front.  One, this will not have step-by-step instructions.  To be helpful, you should already be comfortable installing software and using the command line.  Secondly, as I have already confessed I am not an expert…I am learning, too, so I will try to get it right but I am not promising there won’t be errors and mis-calculations.

Finally, this guide will be specifically targeting people who are ALREADY strong Subversion users.   It will be strongly oriented toward mapping what you already know about Subversion to how Git works.  And pointing out the differences.  If you are altogether new to Version Control, this guide will be of limited use to you. This guide will also be mostly Windows specific.

Setting up Windows to use Git.

To setup your system to use Git you should use Chocolatey.  If you are familiar with Chocolatey then you can skip the next paragraph.

Chocolatey is the package manage for Windows.  (Like apt-get for Linux.  )  It allows you to install software from the command line, with amazing ease.  I recently received a new computer for work and I was able to install almost all the software I use from the command prompt…and fast.  So here is the link to install Chocolatey.

Once Chocolatey is installed, there are three packages I recommend you install from the Packages Gallery:

  • Git (choco install git)
  • Git Extensions (choco install gitextensions)
  • Tortoise Git (choco install tortoisegit)

Of course, in the end you only need one Git client.  But there are reason to install all three, at least while you are learning Git.   Here are my thoughts on each one of them.

Git

When you use chocolatey to install Git, you are installing Git for Windows.  It is kind of the “official” Git client for Windows.  It means that, after installing, you can open a command prompt (Win-R…cmd…enter) and type Git commands because Chocolatey automatically puts Git into your PATH environment variable.

image

That is all well and good, but the only thing you installed is the Git command-line client.  Sometime you just want a nice GUI.  And that is what the next two packages are for.

Git Extensions

Git Extension is a Git client that adds “shell integration” to your windows setup.  And, of course, TortoiseGit does the same thing.  (More on that in a moment).  Shell integration is a fancy way of saying that Git Extensions adds Git items to the windows explorer context menu, like this…

image

This is what you see when you Right-Click on a Windows folder that is also a Git local repository.  These menu options open up various windows that provide a Graphical User Interface (GUI) overlay to Git.

In my opinion, as far as GUIs go, Git Extensions is nothing to write home about.  Nevertheless, there are two reasons to be familiar with Git Extensions.

First, Git Extensions is the “official” GUI for Git and is cross-platform, meaning that Git Extensions is available for Windows, Linux, and Mac.  If you learn Git Extensions on one platform, you are mostly learning it for all platforms.  So this might be particularly important for cross-platform (such as mobile) developers.

Second, Git Extensions give you access to the “old” official Git GUI Client and the Git Bash.  Git GUI is the “old” Git windowing client.  It is now deprecated and has been replaced by Git Extensions.  And Git Bash is the linux terminal client for using Git commands.  If you right-click on an empty area of the right pane in windows explorer of a folder with a Git Repository (not on a folder or file) you see the following…

image

…which opens the Git GUI.  The Git GUI is not a particularly good GUI (even by Git Extensions standards) but you might find tutorials or books that are using it, and it is nice to be able to follow along.  And the same can be said for for Git Bash.  (Although Git for Windows give you the same thing as Git Bash.)  But for those that like bash (linux-like) commands  instead of Windows Dos commands (pwd, cat, ls vs dir, type) then Git Bash might be useful.  Here is a picture of it.

image

TortoiseGit

TortoiseGit is an extremely well-done Windows Shell integrated Git client and GUI.  As far as Git GUIs go, it has several advantages.  First, it is brought to us by the same team that created the wonderful and amazing TortoiseSVN.  These guys REALLY know how to do Windows shell integration and Windows GUIs.  All of the expertise and knowledge that went into TortoiseSVN has been “ported” into TortoiseGit.

Even the icons and terms are the same.  Look at this side-by-side comparison of of TortoiseSVN and TortoiseGit.

TortoiseSVN

image

 

TortoiseGit

image

Notice that these two tools are sharing the same icons and terminology whenever possible.  For those who are already strong TortoiseSVN users, this is an enormous advantage, because it allows us to map our SVN knowledge to Git.  It potentially shortens our learning curve and get’s us productive more quickly.

But, it is also something to be cautious about because the terms may not always have parity-of-meaning and might have us doing something that was “safe” in SVN but much more dangerous when using Git.

In other words, using TortoiseGit does NOT mean that you don’t have to learn what Git does and how it works.

Conclusion

Well, there you have it.  Using Git for Windows, and TortoiseGit gives you a way to use Git effectively from the command line and an extremely well-implemented Windows Shell and GUI.

Using Git Extensions gives you knowledge of a Git Client that works everywhere and is referenced by many of the tutorials and books on Git.

I recommend that you become familiar with all three.

In the next installment, I will talk about how to get started with Git and some fundamental ways that Git differs from Subversion.