Getting started with Git

Rod Tatham's picture
Rod Tatham

This week, I had the opportunity of presenting an introduction to Git to a nice bunch of librarians at Sussex University. This made me think about the best way to learn and use Git for the beginner.  I thought I'd share some thoughts.

Getting started with Git can be rather daunting. You have to understand what it's for and how to use it all at once. You'll find here a suggested approach to understanding Git and answer some common questions. A 'route into Git' if you like.

If you'd like to make some headway, I'd recommend you read through the blog and follow the learning links at the bottom. That should give you a grounding in the concepts and usage and signpost you on in your learning.

Why is it called 'Git'?

It is a name to conjer with, after all! Well, Git inventor Linus Torvalds (who invented the operating system Linux, too) chose the British English slang for a stupid or unpleasant person when naming the software because "I'm an egotistical b******d, and I name all my projects after myself. First Linux, now git." So now you know.

What's Git for?

Git is an open source program for managing a project's files. As a version control system, its two knock-out features are:

  • it keeps the project's history, so you can rewind to a previous version or retrieve an old file if need be,
  • it enables collaboration on those project files, so a whole team can contribute without the versions getting muddled up.

How hard is it to use?

Sure - you have to invest the time to understand Git - but it gets useful quite quickly. Once you've mastered a handful of commands, the core features and usefulness of Git is within your reach. You'll be able to set up and use Git and make it work for you on your projects. Getting the concepts and then the workflow under your belt can be tricky, but if you use the learning links at the bottom of this blog you'll soon be up and running.

What's the difference between Git and Github?

Git is a program that can be used to keep track of changes in a set of files. You need to install Git on your computer before you can use it. It allows you to organise your project's history as you go, and coordinate work on those files among multiple people.

Github is a website service that supports people using Git. It's at https://github.com. It's the 'hub' that all the team members use to copy their changes to and download other people's updates to the project. It's where the project's kept in sync. There are lots of similar services, but Github is the most widely known.

A good way to understand Git's potential is to set yourself up with a Github account and explore some of the countless publicly available repositories (ie projects) that are hosted there. Get familiar with browsing through 'Commits' (snapshots in time of project progress) and explore project collaborators (team members).

Working locally on your Git-enabled project

Your free Github account will allow you to create a brand-new, empty Git repository on Github. To take things a step further, you can 'clone' a copy of it down on your own computer to work on it locally. Here is the workflow that you'll need to get familiar with when working locally on your project:-

  • clone your project from Github down to your local computer;
  • work on your project - adding, editing and deleting files;
  • add those files to your project, then commit them. This two-step process allows you to choose which files you want to include;
  • finally, push the changes back to Github.

Where next?

Work through the excellent interactive tutorial - Got 15minutes and want to learn Git?

Watch this great set of four introductory videos

In summary

Git is a great tool for sharing projects and tracking them across time. Hopefully this has sketched a route into Git for you!

 

 

Add new comment