Git & GitHub Interview Question #65

What is a fork on GitHub?

Undo & Recovery, Tags, Forks, Pull Requests & Code Review Mid-Level Intermediate

Quick Interview Answer

A fork is a repository created within GitHub's repository network from another repository. It allows a user or organization to develop changes independently while retaining a relationship to the original project.

Detailed Explanation

A fork is a repository created within GitHub's repository network from another repository. It allows a user or organization to develop changes independently while retaining a relationship to the original project.

Forks are common in open-source contribution workflows. A contributor can push changes to a branch in the fork and then propose them to the original repository through a pull request.

Code Example

# Typical local setup after cloning your fork
git remote -v

# Add the original project as upstream
git remote add upstream https://github.com/original-owner/project.git