Overview

Git is a tool that tracks changes to your files (code, documents, other) over time. It’s great for working with teams as you can seamlessly combine contributions. It’s also easy to share your work with the world and let others improve your work as well.

You can save “snapshots” of your work and return to earlier versions if needed. GitHub is a website that hosts Git projects online, making it easy to share code, collaborate, and review changes with others.

This tutorial introduces Git and GitHub on Ubuntu, beginning with the everyday commands a new user needs and progressing to collaborative workflows with forks, branches, and pull requests.

By the end, you should understand this workflow:

Remote repository → clone → edit files → stage → commit → push
                                      ↓
                              branch → pull request

The central idea: Git records the history of a project. GitHub stores Git repositories online and adds collaboration tools such as forks and pull requests.

Learning sequence

  1. Clone a repository
  2. Edit, stage, commit, and push changes
  3. Inspect the repository with status, diff, and log
  4. Understand forks and pulling updates
  5. Work safely with branches
  6. Open and complete pull requests
  7. Resolve basic merge conflicts

0. Before you begin

Install Git

On Ubuntu