Track
Branching & Merging
7 Lessons, then a Checkpoint of 5 Challenges.
Builds on Basics.
Lessons
Follow them in order, or play any Lesson once the Track is unlocked.
- Branches
A branch is a name for a line of work. Under the hood it's tiny: a label that points at one commit. Here, every new repository starts on a branch called main…
4 Challenges.
New commands:
git branchgit branch -dgit branch -Dgit branch -mgit switchgit switch -c
- Fast-forward merges
A branch lets you work on something without touching main. When the work is done, you merge it: git merge <branch> brings that branch's commits into the…
3 Challenges.
New commands:
git merge
- Merge commits
A fast-forward only works while your branch hasn't moved since the other one split off. Often both have: you committed on main while contact was still in…
3 Challenges.
New commands:
git merge --no-ff
- Merge conflicts
A merge combines what each branch changed since they split. Changes to different files combine by themselves, and so do changes to one file with an unchanged…
3 Challenges.
New commands:
git merge --abort
- Switching with uncommitted work
Changes you haven't committed come along when you switch branches, as you saw in Branches. But when the other branch has a different version of a file you…
3 Challenges.
New commands:
git stash pushgit stash push -mgit stash push -ugit stash listgit stash popgit stash applygit stash drop
- HEAD and relative refs
HEAD is git's name for where you are. Most of the time it points at a branch, the one you're on, and through that branch at its newest commit. That's why a…
3 Challenges.
New commands:
git switch --detach
- Tags
A tag is a name for one commit, like a branch. The difference is that a tag never moves. When you commit, the branch you're on moves to the new commit, and…
3 Challenges.
New commands:
git taggit tag -agit tag -mgit tag -d
Checkpoint
The Track ends with a Checkpoint of 5 Challenges that use only this Track's commands and those of the Tracks it builds on. Passing the Checkpoint completes the Track, even before you have played every Lesson.