What's the difference between clone, fork and branch?
Take a moment.
Say your answer out loud or write it down first — retrieval is what makes it stick. Reveal when you're ready.
Short answer
Branch is a movable pointer inside one repository — parallel lines of development. Clone downloads a repository to your machine with full history. Fork copies the repository to your own hosting account — used when you can't push to the original.
Detailed explanation
Three levels of isolation. Branches live *within* a repo: cheap pointers letting contributors share one remote while isolating work for review — the default team workflow. Clone brings a repo to local disk: full history, remotes configured; everyone clones regardless of access level. Fork duplicates the entire repository under your account on the platform — your copy, your permissions — connected to upstream via convention (git remote add upstream). Forks serve two audiences: external open-source contributors without write access (fork → clone fork → branch → push → PR upstream), and organizations needing experimentation space or security separation. Team members with write access skip forking entirely: clone canonical, push branches directly. Practical notes: sync forks via upstream fetch + main reset, or GitHub's 'Sync fork' button; keep origin/upstream naming consistent across teams; forks don't include issues/wiki/settings — they're code copies.
Example
# Open-source contribution flow:
git clone https://github.com/YOU/project.git
cd project
git remote add upstream https://github.com/ORIG/project.git
git checkout -b fix-typo
# ...commit...
git push origin fix-typo # → open PR against upstream
# Team member flow:
git clone https://github.com/ORIG/project.git
git checkout -b feature-x && git push -u origin feature-xInterview tip
Anchor each to permission levels — branch (same repo), clone (local copy), fork (hosting-level copy for no-write-access contributors). The OSS workflow demo seals it.
Common mistakes
- Forking repos they already have write access to.
- Not knowing forks lack issues/settings from upstream.