Topic 5 of 12
Git and collaboration
Understand how git records history, how branches, remotes and pull requests work, and how to undo mistakes and keep secrets out of a repository.
After this topic you can: Explain what a commit and a branch really are, work safely with a shared repository, recover from common mistakes, and know what to do when a secret is committed.
8 lessons · 84 min · 0 of 8 done
Best read after: Linux and the shell
Draft. This lesson is written and waiting for a person to run every command and review it. It is safe to learn from, but check the official documentation for anything you depend on.
Lessons, in order
- 1How git stores historyCoreSee that a commit is a snapshot with a parent, a branch is a movable label and HEAD is your position, so later git commands stop feeling like magic.9 min
- 2Staging and writing commitsCoreLearn why git has a staging area between your files and a commit, how to check what is staged, and how to write commit messages that help later.9 min
- 3Branches and mergingCoreLearn why a branch costs almost nothing, how to switch between them, and how a merge joins two lines of work with or without a merge commit.10 min
- 4Remotes, fetch, push and pull requestsCoreUnderstand origin, fetch versus pull versus push, why a push gets rejected, and how a pull request moves a branch into main with review.13 min
- 5Resolving merge conflictsCoreLearn why git sometimes cannot merge on its own, how to read conflict markers, and a calm sequence for resolving and finishing or aborting a merge.10 min
- 6Undoing mistakes safelyCoreKnow which of restore, reset, revert and reflog is safe, which rewrites history, and how to recover a commit that seems lost.12 min
- 7Branching strategies and trade-offsAdvancedCompare trunk-based development, feature branches and release branches, see when each fits, and try a release branch with a cherry-picked fix.11 min
- 8Keeping secrets out of gitCoreLearn how .gitignore works and why it cannot protect committed files, and the right order of steps to take when a password or key lands in history.10 min