17 Mar

Beginner’s Guide to Git

Now I know that SharePoint plays well with Team Foundation Server, Microsoft’s source code management platform for Visual Studio. However it is not a free solution, and as I don’t have it as a resource, I looked into implementing Git for my visual web part development version control needs.

There is a lot of very detailed information about Git out there, but as I was doing my own research, I was feeling a bit overwhelmed by all the concepts and tools and commands, that in the beginning I couldn’t even figure out where to start. So I decided to first use the GUI client and evolve from there when it became necessary. The next few posts will be a guide for absolute beginners, as I was, who may have never used version control before but heard from someone that it is probably a good idea to start.

99 Little Bugs in the Code

Should I Bother With Version Control?

Don’t use version control? Maybe you’re thinking, ‘Ugh, this is one more thing I have to add to my workflow.’ If you weren’t taught to use version control in school, been forced to use it at your workplace, or had it drilled into you in programming classes, etc. it can be challenging to get into the habit of doing a Commit after every few lines of code – but it’s totally worth it. Gone are the days of copying files into folders named with the date and/or time. Or yelling at your coworkers or little brother for writing over your precious source code. Or wasting hours trying to ‘undo’ the new code that broke the functionality that you had working perfectly (sort of). Now you will enter a new chapter of the novel of your programming adventures and not look back.

Who Should Use Version Control?

If you work with computer files and change them on a consistent basis, you should consider using version control. Now some applications have it already built in, and you don’t need a separate 3rd party system. For example, out of the box SharePoint can keep track of ‘Version History’ with documents like Word and Excel. So you probably don’t need to teach the computer-challenged 75 year old secretary in your office how to use Git. (OK unless she wants to. I’ve worked with some 75 year olds excited about using learning how to computers and it’s fun!)

But for web, software, or application developers of any size project, I would say a robust version control system like Git is a must. You can use Git for any platform, programming language, etc. as long as you are working with files! And it’s not just for the programmers in the team – if your designer touches the CSS files or if you have hard-coded verbiage that Marketing switches out, bring them into the version control loop too. This Beginner’s guide should make it easy to use for them as well.


First step: Installation. Git is like any other program you would install to your desktop, and the best place to get it from is the download page on the official website. Simply choose your operating system and it will serve you the correct download. From there, click the installation file and follow the steps.

Git Installation Screen

Git Installation Screen for Windows

Next, install a GUI client. Actually, I fooled you – installing a GUI client will automatically install Git for you first. But it’s good to know where to go if you need plain ole’ Git. Here is the official page of GUI clients for Git, although there may be more out there. I will be using GitHub for Windows in this tutorial, as it is free and has a sleek, non-intimidating UI that is good for beginners. You may want to spring for a fancier GUI if you need more functionality later.
Snapshot from Windows for GitHub website

GitHub for Windows looks kinda like this

Create a Repository

Now that you have Git installed, we’ll create a repository. If you’re an absolute beginner, the word ‘Repository’ might not mean anything to you. The simplest way to explain it is a Repository is the directory that holds all the files you are tracking for one project. Grouping everything into a ‘Repository’ keeps your files organized for Git, who is going to mark these files for changes and track their history for you.

You can create an empty directory and use it for the repository, or you can use an existing directory with files that you want to start versioning. In my case, I created an empty folder called ‘SampleRepository’. Note that you cannot use spaces, as the name of the folder will become the name of your repository.


Next, open up the GitHub for Windows GUI client. Select ‘repositories’ under Local, then click the “+create” button at the top of the screen.

Click the Create button 

Give the repository a name and description. The name must match the directory you’ve created or are using as the repository. Browse to the parent folder by clicking the and then click the “Create” button at the bottom.

New Repository screen 

That’s all there is to it. The new repository should be listed in your Local repositories list. Also, when you open up the directory in explorer, you’ll notice the necessary Git files have been created.

Hidden Git files 

You’ll see a hidden folder called .git, and then a .gitattributes and .gitignore file. The handy one here is the .gitignore file, because you can specify which files in the Repository that you don’t want Git to track. For example, you can exclude certain types of files, like files that keep metadata for projects generated by applications like Visual Studio, debug logs, etc. I won’t get into the details of it, but you can get more information here.

What’s Next?

Creating a Repository is the first step, and now we have to actually learn how to utilize Git. The next few posts in Beginner’s Guide to Git will go into Remote Repositories, and the basics of working with your repository (Commit, Revert, & Roll Back).


Copyright © 2014 Keren Apura; Fruitful theme by fruitfulcode