Domain 1: Introduction to Git and GitHub (22%) โ
Git vs GitHub โ
Git and GitHub are often confused โ understanding the distinction is foundational to this exam.
Git is a free, open-source distributed version control system that runs locally on your machine. It tracks changes to files, enables branching, and supports collaboration through merging.
GitHub is a cloud-based hosting platform built on top of Git. It adds collaboration features: pull requests, Issues, Actions, Codespaces, and more.
| Aspect | Git | GitHub |
|---|---|---|
| Type | CLI tool / version control | Cloud platform |
| Runs | Locally on your machine | Web + cloud |
| Created by | Linus Torvalds (2005) | GitHub, Inc. (2008) |
| Core function | Track file changes | Host repos + collaborate |
| Can work without the other? | Yes (local only) | No (needs Git underneath) |
Exam Tip
Questions about "where does this happen" โ if it's tracking changes, commits, or branching, answer Git. If it involves pull requests, Issues, or web interface, answer GitHub.
Core Git Concepts โ
Commits โ
A commit is a snapshot of your files at a point in time. Each commit has:
- A unique SHA hash (e.g.,
a3f5b2c) - An author and timestamp
- A commit message describing the change
- A pointer to the parent commit(s)
git commit -m "Add user authentication module"Branches โ
A branch is a lightweight, movable pointer to a commit. The default branch is typically named main (formerly master).
- Create a branch:
git branch feature/login - Switch to it:
git checkout feature/loginorgit switch feature/login - Create + switch:
git checkout -b feature/login
Merging โ
Merging integrates changes from one branch into another. Types:
- Fast-forward merge โ linear history, no merge commit needed
- Three-way merge โ creates a merge commit when histories have diverged
The Three States of Git โ
| State | Location | Description |
|---|---|---|
| Working directory | Local files | Where you edit files |
| Staging area (index) | .git/index | Files marked for the next commit |
| Repository | .git/ | Committed history |
Working Dir โ git add โ Staging โ git commit โ RepositoryKey Workflow
git add moves changes to staging. git commit moves staged changes to the repository. git push sends commits to GitHub.
Essential Git Commands โ
| Command | What it does |
|---|---|
git init | Initialize a new local repo |
git clone <url> | Copy a remote repo locally |
git status | Show working tree status |
git add <file> | Stage changes |
git commit -m "msg" | Commit staged changes |
git push | Upload commits to remote |
git pull | Fetch + merge remote changes |
git log | View commit history |
git diff | Show unstaged changes |
GitHub Interface Options โ
GitHub can be accessed through multiple interfaces โ the exam tests which to use when.
| Interface | Best for | Key features |
|---|---|---|
| Web UI (github.com) | Browsing, reviewing PRs, Issues | Fully featured, no install |
GitHub CLI (gh) | Scripting, terminal workflows | Create PRs, Issues from terminal |
| GitHub Desktop | Visual beginners | GUI drag-and-drop |
github.dev (press . in any repo) | Quick edits in browser | VS Code in browser, no compute |
| Codespaces | Full dev environment | Cloud VM with VS Code |
Common Trap
github.dev and Codespaces look similar but differ fundamentally. github.dev is a browser editor with no terminal/compute. Codespaces is a full cloud VM you can run code in.
Repository Visibility Types โ
| Visibility | Who can see it | Use case |
|---|---|---|
| Public | Everyone (internet) | Open source projects |
| Private | Only invited collaborators | Personal or commercial work |
| Internal | All members of the organization | InnerSource (enterprise only) |
Internal Repos
Internal visibility is only available on GitHub Enterprise Cloud organizations. It enables InnerSource โ sharing code across teams within a company without making it fully public.
GitHub Flavored Markdown (GFM) โ
GitHub renders Markdown across READMEs, Issues, PRs, Discussions, and Wikis. Key GFM extensions:
| Syntax | Renders as |
|---|---|
**bold** | bold |
*italic* | italic |
# Heading | H1 heading |
`code` | inline code |
- [ ] / - [x] | task list (unchecked/checked) |
@username | user mention (notifies them) |
#123 | links to Issue/PR #123 |
> text | blockquote |
Exam Tip
Task lists (- [ ]) in Issues and PRs are tracked as completion progress. @mentions trigger notifications. # references auto-link Issues and PRs.
Domain 1: Git & GitHub Fundamentals
What is the difference between Git and GitHub?
(Click to reveal)