Fork — Explained with Examples
A fork copies a repository to another account, enabling independent development and contributions back via pull requests without affecting the original.
Forking creates a personal copy of someone else’s repository under your own account. You own the fork and can make any changes you want without affecting the original project. To contribute back, you submit a pull request from your fork to the original repository (upstream). Forks are central to the open source contribution model on platforms like GitHub and GitLab.
Think of forking like borrowing a cookbook from a library. You photocopy the recipes (fork), write your modifications on the copy, and if your changes are good, you submit them back to the library so everyone gets an updated cookbook (pull request). You never alter the library’s original book.
Forks differ from branches: a branch exists within the same repository, while a fork is a separate repository. Anyone with read access can fork a public repository. Forks maintain a connection to the upstream repository, allowing you to sync changes from the original.
# After forking on GitHub, clone your fork
git clone https://github.com/YOUR_USERNAME/original-repo.git
# Add upstream remote
git remote add upstream https://github.com/ORIGINAL_OWNER/original-repo.git
# Sync with upstream
git fetch upstream
git merge upstream/main
git push origin mainForking is the standard workflow for contributing to projects where you do not have write access. Many organizations also use forks internally to isolate experimental work.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro