11. Version Control

Creating a history of code changes and sharing code with your team.

Coding is an incremental activity. You write code, it’s a little broken, you fix it. You work on the next thing, it’s a little broken, you fix it. And so forth until you’re “done”.

During the coding process, you have probably done the following:

  • Saved a copy of the file at a point when you know it just works. Then you keep coding.
  • Wanted to go back in time to a point when everything did work so you can start over.
  • Had to email or otherwise share your code files between computers.

Version Control Systems (VCSes) are systems that manage changes to source code, documents, and other files over time. VCSes are also how all teams store and share their code on a shared project. VCSes are essential to software engineering.

A VCS is a computer application, the most prolific of which is called Git and was created by Linus Torvalds, the creator of Linux. All VCSes, including Git, have the following features:

  1. The ability to make a version: a snapshot of the project files at the current time.
  2. The ability to revert to an earlier version.
  3. The ability to compare versions of the project files to see their differences.
  4. The ability to share versions with a central repository that multiple people can access.

Importantly, it is up to the programmer to decide when to create a version, when to revert, and when to share. This is in contrast to your OS or an app like OneDrive or Google Drive, which do some of these things automatically.

We will use Git and GitHub in this class as our VCS. We will start by setting up these tools on your computer.


Git and GitHub setup

Setting up Git and GitHub utilities

Git basics

Basic Git concepts and commands

Undoing mistakes with Git

Resetting your work to a safe state

Branching and Merging, Part 1

Working concurrently

Branching and Merging, Part 2

Handling merge conflicts

GitHub CLI setup

Prepare to work with remote repositories on GitHub

Remote repos

Sharing your version history through a server

Last modified October 21, 2024.