Forking and the Fork Network - UP-Manila-SILab/ph-core GitHub Wiki
The GitHub fork network is a conceptual and technical structure that represents how repositories are forked and related to each other. Here's a breakdown of how it works and how it's documented:
🔁 What Is a GitHub Fork?
A fork on GitHub is a personal or organizational copy of someone else's repository. It allows you to freely experiment with changes without affecting the original project. Forks are commonly used to propose changes to someone else's project via pull requests or to use someone else's project as a starting point for your own idea.
🌐 The Fork Network
The fork network refers to the entire tree of repositories that originate from a common ancestor. This includes:
- The upstream repository (the original).
- All forks of that repository.
- Any forks of those forks, recursively.
graph TD
Upstream["Upstream Repository"]
UserA["UserA's Fork"]
UserB["UserB's Fork"]
UserC["UserC's Fork of UserB"]
Upstream -->|Fork| UserA
Upstream -->|Fork| UserB
UserB -->|Fork of Fork| UserC
GitHub tracks this network and allows users to:
- View the network graph to see how forks relate.
- Sync forks with upstream repositories.
- Submit pull requests across forks.
🧭 Key Features and Improvements
GitHub has introduced several enhancements to fork management:
- Syncing Forks: You can now sync your fork with the upstream repository directly from the web UI or via API 1(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/)(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/).
- Fork Naming: You can name your fork during creation 1(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/)(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/).
- Forking Within the Same Organization: Previously restricted, now allowed for better internal collaboration 1(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/)(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/).
- Fork Policies: Enterprise owners can control where forks can be created (e.g., within the same org, to user accounts, etc.) 1(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/)(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/).
- Selective Branch Forking: You can fork only the default branch instead of all branches 1(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/)(https://github.blog/developer-skills/github/unboxing-fork-improvements-and-unwrapping-fork-docs/).
🤝 Friendly Forks
GitHub distinguishes between friendly forks and divergent forks:
-
Friendly Forks:
- Maintain a collaborative relationship with the upstream project.
- Regularly sync with upstream and contribute back.
- Examples:
git-for-windows/git
,microsoft/git
,github/git
2(https://github.blog/developer-skills/github/the-friend-zone-friendly-forks-101/)(https://github.blog/developer-skills/github/the-friend-zone-friendly-forks-101/).
-
Divergent Forks:
- Created due to disagreements or different goals.
- Often evolve independently and may not share code with upstream.
📚 References and Further Reading
Here are the official GitHub resources that explain these concepts in detail: