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.

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.

New here? Read in this order: Getting Started with Git and GitHub, then Repositories and Cloning, Commits and Branches; next Checkout, Switch and Restore and Fetch, Pull and Push; then Merging, Rebasing and Conflicts and Pull Requests; and finally Tags and Releases. As advanced topics, when a repository has to change host or owner, read Migrating Repositories Between Providers and Transferring Repositories Between GitHub Accounts. To automate builds, tests and releases from GitHub, continue with the GitHub Actions reference.

GitHub Actions

Sections

Foundations

  • Getting Started — 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 the two jobs of git checkout 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.

Moving repositories

  • Migrating Repositories Between Providers — moving a repository between Git hosts (Bitbucket Cloud to GitHub as the example) with every branch and tag via git clone --mirror and git push --mirror, Git LFS objects, GitHub’s file-size limits, and re-pointing clones.

  • Transferring Repositories Between GitHub Accounts — GitHub’s built-in ownership transfer on github.com and with gh api, what moves, redirects and their limits, and when to fall back to a mirror copy.

CI/CD

  • GitHub Actions — workflows, triggers, jobs and matrices, runners, actions, caching, secrets and OIDC, environments, reusable workflows, security hardening, release pipelines to Maven Central, npm, PyPI, NuGet, GHCR and GitHub Pages, troubleshooting and a cheat sheet.

Reference

  • Cheat Sheet (PDF) — a one-page, printable summary of the whole section, with a downloadable PDF.

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