Git and version control
Git keeps the full history of a project, lets several people change it at the same time, and lets you go back when something breaks. This track takes you from your first commit to resolving conflicts and rescuing "lost" work.
What you will be able to do
By the end of the track you can:
- create a repository, stage exactly the changes you mean, and write commits other people can read;
- work on a branch, merge it back, and read a commit graph;
- clone, fetch, pull and push, and choose between HTTPS and SSH sign-in;
- resolve a merge conflict by hand or in a three-way merge tool;
- tidy commits with an interactive rebase before you share them;
- undo almost anything, and know the few things that cannot be undone.
Who it is for
Students, testers, new developers and anyone who has been told to "just push it to Git" without an explanation. You need a computer with Git installed and a terminal. No programming is needed: the examples use plain text files.
The lessons
Read them in order. Each one builds on the one before and ends with a short quiz.
Lesson 1What Git isSnapshots, repositories, and the three places your work lives.Lesson 2CommitsStage changes, even part of a file, write good messages, and set your identity.Lesson 3Branches and mergingBranches as movable labels, HEAD, fast-forwards and merge commits.Lesson 4RemotesClone, fetch, pull and push, HTTPS or SSH, forks and pull requests.Lesson 5Conflicts and rebaseWhy conflicts happen, how to resolve them, and when to rebase.Lesson 6Undo and stay safeRestore, revert, reset, stash and the reflog safety net.LabGit labBuild a repository, branch, cause a real conflict, squash and rescue a commit.
Dhiva Labs apps that use this
| App | What it does with Git |
|---|---|
| BranchPilot | A Git client for Linux: commit graph, hunk staging, merges, conflicts, interactive rebase, stash, tags and reset |
| Delta View | Compares files and folders, and works as git difftool and git mergetool for three-way merges |
| DhivaLabs Shell | A Bash terminal for Windows that keeps separate Git identities, SSH keys and history for work, personal and client accounts |
| DL Sentinel | Scans a project folder for secrets and other risks before you commit them |
How long it takes
Each lesson takes 15 to 25 minutes, including the quiz. The lab takes 45 to 60 minutes. Spread it over a few sittings: Git sticks better when you practise between lessons.
Next steps
- Start with What Git is
- Install BranchPilot now, so it is ready for the lab