Skip to main content

Tutorial series

Git and GitHub workflow

Learn the Git commands you use every day, from the first commit to a pull request.

  1. How to Install and Configure Git

    You will install Git 2.53 from Ubuntu 26.04's own packages, set your name and email, make main the default branch, choose an editor and a few safe defaults, use a different email for work projects, and create an SSH key to use with GitHub.

    Beginner · 14 min

  2. How to Make Your First Git Commits and Read the History

    You will turn a folder into a Git repository, make commits in small steps, check what changed before you commit, ignore files that do not belong in history, rename and delete files, and read the history back in several ways.

    Beginner · 16 min

  3. How to Create, Switch and Merge Branches in Git

    You will create branches, switch between them, commit on each, merge one into another in the two ways Git can, read the branch graph, and delete branches you no longer need.

    Beginner · 15 min

  4. How to Resolve a Git Merge Conflict

    You will cause a merge conflict on purpose, read the conflict markers, resolve it by editing the file, finish the merge, back out of a merge you do not want, and pick one side of a conflict with a single command.

    Intermediate · 14 min

  5. How to Undo Mistakes in Git: restore, revert, reset and reflog

    You will discard edits, unstage files, fix the last commit, undo a commit safely with revert, move a branch back with reset, and bring back commits you thought you had lost with the reflog.

    Intermediate · 17 min

  6. How to Keep Passwords and API Keys Out of Git

    You will keep secrets in a git-ignored .env file, commit a safe template instead, stop a commit that contains a key with a pre-commit hook, and learn what to do when a secret has already been committed.

    Beginner · 12 min

  7. How to Push to GitHub over SSH and Open a Pull Request

    You will connect a local repository to a new GitHub repository over SSH, push your work, push a branch, open a pull request from the website and from the GitHub CLI, merge it, and bring the result back to your computer.

    Beginner · 16 min