Git
Save, share and undo every change to your code — commits, branches, merging, rebasing and recovering mistakes.
- Module 7 of 8
- Beginner
- 11 chapters
- 55 min
Every team uses Git, and most Git trouble comes from not knowing what it does underneath. Once commits are snapshots and branches are pointers, merging, rebasing and recovery stop being scary.
What you will be able to do
- Explain what a commit, a branch and HEAD really are
- Merge, resolve conflicts and rebase with confidence
- Work in a team with remotes and pull requests
- Undo almost any mistake
Chapters
1. What Version Control IsA version control system (VCS) records changes to files over time so you can recall any version.3 min2. Your First CommitsA repository (repo) is a project folder that Git tracks. Git keeps all its history in a hidden folder5 min3. What a Commit Really IsA hash is a fixed-size fingerprint computed from any amount of data. The same input always gives the same hash;4 min4. Branches and HEADA branch is just a movable pointer to a commit — literally a tiny file containing a commit hash.3 min5. Merging and ConflictsMerging combines the changes from one branch into another: git merge bonus (run while on main) brings bonus's4 min6. Rebasinggit pull --rebase — put your local unpushed commits on top of what's new on the server, instead of creating a4 min7. Remotes: Clone, Fetch, Pull, PushA remote is another copy of the repository, usually on GitHub. The default name for the one you cloned from is4 min8. Team Workflow: Branches, Pull Requests, Reviewsmain is the printed edition: always working, always deployable. Nobody commits to it directly.3 min9. Undoing ThingsDifferent kinds of "undo" for different situations: rubbing out a pencil mark you haven't photographed yet; taking a5 min10. What Never Goes Into Git.gitignore is a file listing patterns of files Git should never track.3 min11. Investigating HistoryA detective's toolkit: compare two photos side by side; ask "who last changed this sentence?"; and, when you know the3 min
Extras
The Whole StoryThe whole module retold as one story — no new facts, a fast revision of Git.RevisionInterview QuestionsReal interview questions on Git, answered the way you would say them out loud.Interview prepQuick ReferenceGlossary and cheat sheet for Git — the page to reread before an interview.Reference