Cheat sheet · Foundations
Git cheat sheet
Opens with creditsA quick-revision book on Git, from the model underneath (working tree, index, commits, refs) to branching, rebasing, remotes, undoing mistakes and team workflows. Read a chapter before a project or when a command surprises you, and use the glossary to refresh a term you half remember.
Chapters
9 chapters · 65 concepts
1How Git thinksGit makes sense once you know what it stores: snapshots of your files, linked into a history, with movable names pointing into that history. Every command in this sheet moves data between these places.7 concepts
- 1RepositoryA project folder tracked by Git.
- 2Working treeThe files you see and edit on disk, checked out from one commit.
- 3Staging areaA draft of the next commit.
- 4CommitA snapshot of the whole project at one moment, plus an author, a message and a pointer to its parent commit (two parents for a merge).
- 5Blobs, trees and hashesGit stores file contents as blobs, folders as trees and snapshots as commits, each addressed by a hash of its content.
- 6Branches and refsA branch is just a named pointer to a commit.
- 7HEAD and detached HEAD
HEADis the pointer to what you have checked out, normally a branch name.
7 in this chapterOpen this chapter2Setup and everyday commandsConfigure Git once, then most days are a loop of status, add, commit and push. These are the commands you will type most often.7 concepts
- 1git configSets options at three levels: system, global (your user, in
~/.gitconfig) and local (one repository). - 2git init and git clone
git initturns a folder into a new repository. - 3git statusShows the current branch, how it compares with its upstream, and which files are staged, modified or untracked.
- 4git addStages changes into the index.
- 5git commitRecords the staged snapshot as a new commit on the current branch.
- 6git diffShows line changes.
- 7git rm and git mv
git rmdeletes a file and stages the deletion;git rm --cachedstops tracking it but keeps it on disk.
7 in this chapterOpen this chapter- 1git configSets options at three levels: system, global (your user, in
- Branching, merging and rebasingBranches let work happen in parallel; merge and rebase bring it back together. Knowing which to use, and how to resolve a conflict calmly, is most of day-to-day Git skill.8 conceptsOpens with credits
- Remotes: fetch, pull and pushA remote is another copy of the repository, usually on GitHub or GitLab. Git never talks to it unless you fetch, pull or push, so knowing what each does avoids most surprises.7 conceptsOpens with credits
- Undoing thingsAlmost nothing committed in Git is truly lost. The right undo depends on where the mistake lives: the working tree, the index, a local commit or a pushed commit.7 conceptsOpens with credits
- History and inspectionGit history answers why code is the way it is, who to ask, and when a bug arrived. These commands turn the log into answers.7 conceptsOpens with credits
- Tags, releases and code reviewHosting platforms add review and release features on top of Git. Pull requests on GitHub and merge requests on GitLab are the same idea with different names.7 conceptsOpens with credits
- Workflows and commit hygieneA workflow is the team agreement on how branches, reviews and releases fit together. Good commits make any workflow easier to live with.7 conceptsOpens with credits
- Ignoring, large files, signing and worktreesThe features you need once a project grows: keeping junk and secrets out, handling big binary files, proving who made a commit and working on two branches at once.8 conceptsOpens with credits
- 10Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.87 terms
About this sheet
How Git stores your work, the everyday commands, branching, undoing mistakes, remotes, reviews and team workflows.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- Git Best Practices for DevelopersGit best practices for everyday work: clear commits, clean branches and pull requests, rebase vs merge, safe force pushes, secrets, signing and recovering mistakes.
- Code Review Best PracticesCode review best practices for reviewers and authors: the approval standard, what to look for, review speed, writing kind and useful comments, handling disagreement and small changes.
- Technical Writing Best Practices for EngineersTechnical writing best practices for developers: write for your audience, clear sentences, scannable structure, design docs, READMEs and docs, PR descriptions, async updates and blog posts.
Checklists
See allProject structures
See all- VS Code extension project structureA TypeScript extension for Visual Studio Code, built from the official Yeoman generator with esbuild bundling. The example, TODO Lens, finds TODO comments and shows them in a tree view, with commands, settings and editor decorations. The tree grows from the generator's Hello World into commands, providers and editor-free core logic, then tests on three operating systems, publishing to the Marketplace and Open VSX, and a webview with a strict security policy. For students who use VS Code every day and want to build a tool other developers install.
- Turborepo monorepo project structureOne Git repository holding several apps and the packages they share, wired together by pnpm workspaces and run by Turborepo.
apps/holds things you deploy (two Next.js apps from the starter, later an API),packages/holds shared code and config (UI components, ESLint and TypeScript configs, validation schemas, the database client). Turborepo runs each task in dependency order and caches the results, so you never rebuild what did not change. - Chrome extension project structureA Manifest V3 Chrome extension that saves highlights from any page into a side panel, built with WXT, React and TypeScript. WXT reads your
entrypointsfolder and writes the manifest for you, so the layout is one folder per thing Chrome loads (service worker, content script, popup, side panel, options) with shared code inutils. For students who have loaded an unpacked extension once and want to ship a real one to the Chrome Web Store.
Career questions
See all- How do I learn Git and GitHub properly instead of just copying commands?Learn the model first: commits are snapshots, branches are pointers, and remotes are copies. Then use Git daily on your own projects, practise a team workflow with branches and pull requests, and break things on purpose, such as merge conflicts, so you learn to recover calmly.
- Which AI tools do employers expect junior developers to know in 2026?Employers rarely require a specific brand. They expect you to use an AI coding assistant well (in the editor and in the terminal), to review and test what it produces, to call an LLM API in a small feature, and to explain when you would not use AI. Pick one assistant, learn it properly, and show judgement in your projects.
- How do I build a developer portfolio as a beginner with nothing to show?Start with two or three small but complete projects that solve a real problem, each with a clear README, screenshots and a live link or easy run steps. Put them on a simple one-page site or a tidy GitHub profile. Depth and finish matter far more than the number of projects or a fancy design.
Cheat sheets
See allStuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com