GitGitHub
Git for deployers
Git from the first commit to branches, remotes and the workflow that triggers a deploy.
- 10 lessons
- 2h 35m estimated time
- 2 hands-on labs
- 3 animated diagrams
- 10 quizzes
6 beginner, 4 intermediate. Start at the top or pick a chapter below.
0 of 10 done
Saved in this browser as you finish lessons.
Git basics
What Git is, how to set it up and how to commit and undo safely.
01 Up next What is Git and why servers use it for deploys Git is a version control system that records every change to your files as a commit, so a server can fetch an exact version of your code and you can return to any earlier one. 10 min Beginner 02 Up next Install and configure Git on Ubuntu or Debian Install Git with sudo apt install git, then run git config --global to set your name, email, default branch and editor so every commit is labelled correctly. 10 min Beginner 03 Up next Your first Git repository: init, add, commit and log A Git repository starts with git init, and you save work by staging files with git add and recording them with git commit, then review it with git log and git diff. 15 min Beginner Lab Diagram 04 Up next Undo mistakes in Git: restore, amend, reset, revert, reflog To undo something in Git, pick the tool by where the mistake is: restore for files, commit --amend for the last commit, reset for local history, revert for shared history and reflog to recover. 20 min Intermediate
Branches
Work in parallel and bring the work back together.
05 Up next Git branches and merging: create, switch, merge, delete A Git branch is a movable label on a commit, so you can build a change on its own line of history and then combine it into main with git merge. 15 min Beginner Lab Diagram 06 Up next Resolve Git merge conflicts step by step A merge conflict happens when two branches changed the same lines, so you edit the marked file to keep the right text, run git add, and finish with git commit. 15 min Intermediate
Working with a host
Remotes, keys, ignored files and the workflow that triggers a deploy.
07 Up next Git remotes: push, pull and fetch explained A Git remote is a named URL of another copy of the repository, and you send commits to it with git push and bring new ones back with git fetch or git pull. 15 min Beginner Diagram 08 Up next SSH keys and deploy keys for Git on a server A deploy key is an SSH key pair whose public half is added to one repository as read-only, so a server can clone and pull that repository without your personal account. 20 min Intermediate 09 Up next Gitignore and keeping secrets out of Git A .gitignore file lists patterns Git should not track, and secrets such as .env files belong there, because anything committed stays in history even after you delete it. 15 min Beginner 10 Up next A Git workflow that triggers a deploy A Git deploy workflow moves a change through a feature branch, pull request and review into main, where CI tests it and a deploy ships it, with tags marking releases you can redeploy. 20 min Intermediate