Git / Github

When working with code, it's easy to loose track of the different changes you have made and the different iterations the project has undergone. One solution to this problem is to use version control—a system that remembers all the previous versions of the code and where it has changed, which ensures you are always working on the most current version and that you can always roll back your changes if something goes wrong. Git is the most popular version control protocol in use today, and Github is a webapp that enables easy and free storage and management of projects in git.


A repository is what we call a single project in git version control. For our purposes, you should probably set up a repository for each website you create. The repository holds all the code files, folders, and other files such as media that make up the site. When you make a repository on Github, it serves as a safe, online copy of your code.


When you have made some changes to your project that you think you are ready to keep, you make a commit to the git repository. As the name implies, this can be thought of as "making it official" with regard to your changes. Another way to think of a commit is that it is like pressing save in a word processor. The changes are recorded and will be present when you return to the repository in the future. If you make changes but don't commit them, they are not yet saved in the repository.

Think of making a commit as similar to pressing save in a word processor.

A common work flow is to keep a working copy of your project on your local computer, and then to commit satisfactory changes to a git repository online, like Github. That way, you can play around and test code-in-progress safe in the knowledge that the repository is safe from any accidents.

When making a commit, you must add a commit message with a brief description of what changes you have made. This makes it easy to look through your version history and understand what happened at which point.


There are many ways to work with git and many more features and possibilities than mentioned here, but for the purposes of this course, here is a suggested workflow:

Video Lesson