Git lessons: introduction
These lessons are an introductory Git tutorial. They covers the basics of creating local repositories as well as tracking new files and changes to existing files. They will also cover branching, merging and working with remote repositories.
What is Git. Git is a version control system. As described by Scott Chacon and Ben Straub in the introduction of their book Pro Git:
“Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. For the examples in this book you will use software source code as the files being version controlled, though in reality you can do this with nearly any type of file on a computer.
If you are a graphic or web designer and want to keep every version of an image or layout (which you would most certainly want to), a Version Control System (VCS) is a very wise thing to use. It allows you to revert files back to a previous state, revert the entire project back to a previous state, compare changes over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. Using a VCS also generally means that if you screw things up or lose files, you can easily recover. In addition, you get all this for very little overhead.”
Other good resources. A quick interactive introduction to Git can be found here. The main Git website is great resource and includes some documentation and videos. Other good resources include the Pro Git book by Scott Chacon and Ben Straub, which has a free online version, and Git for Scientists: A Tutorial by John McDonnell. And if something is not clear or you run into trouble, remember, Google is your friend.
The best way to use this tutorial is to work thought each lesson in order. Read the descriptions and run the included code on your your own computer. You will gain a better understanding of Git and the command line if you take the time to type each command yourself, or at the very least copy-and-paste and run each command individually.
It is assumed that you have a basic understanding of the command-line, whether you are working with Windows, Mac or Linux. This tutorial is written with Linux-style file paths, but the Windows equivalent will be mentioned where appropriate.
Let’s get started by configuring Git!