Git & GitHub

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production; see the section bibliography for the reference material consulted while preparing these pages.

Git is the distributed version-control tool that tracks every change to a project’s files as a graph of snapshots; GitHub is a hosting and collaboration platform built around Git repositories, adding pull requests, issues, code review, Actions and a web UI on top of the same underlying Git history. This section teaches the day-to-day Git and GitHub workflow — repositories, commits, branches, tags, checkout/switch/restore, fetch/pull/push, merging and pull requests — explaining each concept, then showing the same operation four ways: the command line (git, and gh where relevant), GitHub.com, IntelliJ IDEA and VS Code. The examples are written and verified against Git 2.55.x, GitHub CLI 2.101.x, IntelliJ IDEA 2026.2, current stable VS Code with the GitHub Pull Requests and Issues extension, and github.com as of September 2026, with main as the default branch throughout.

What’s covered

Foundations

  • Getting Started with Git and GitHub — version control and why Git is distributed, Git versus GitHub, installing Git, first-time setup, authenticating with HTTPS or SSH, and IDE setup in IntelliJ IDEA and VS Code.

  • Repositories and Cloning — the .git directory and the three areas (working tree, staging area, repository), git init versus git clone, .gitignore, remotes, and creating, cloning or forking a repository.

Everyday work

  • Commits — what a commit is, staging and committing, writing good commit messages, inspecting history, and amending, restoring, reverting and resetting.

  • Branches — branches as movable pointers, the branch commands, local versus remote-tracking branches, and GitHub flow versus a Git-flow-style workflow.

  • Checkout, Switch and Restore — how git checkout’s two jobs became `git switch and git restore, detached HEAD, and switching with uncommitted changes.

  • Tags and Releases — tags as fixed pointers, lightweight versus annotated tags, and GitHub releases built on tags.

Collaborating

  • Fetch, Pull and Push — moving commits between a local repository and origin, rejected non-fast-forward pushes, and --force-with-lease versus --force.

  • Merging, Rebasing and Conflicts — fast-forward and three-way merges, resolving merge conflicts, and git rebase.

  • Pull Requests — proposing, reviewing and merging changes with pull requests, on github.com, with the GitHub CLI, in IntelliJ IDEA and in VS Code.

Reference

Once a branch is pushed, what happens next is usually a CI/CD pipeline: see Docker CI/CD with GitHub Actions and React Native CI/CD and Over-the-Air Updates for how pushes, tags and pull requests trigger GitHub Actions workflows in this account’s projects.

Bibliography

Every page in this section links to the specific official page each step list or command is derived from; where this bibliography and a concept page’s own == References section ever appear to disagree, the official documentation linked from the concept page wins.