Skip to content
X

What Is a Fork? - How to Customize Open Source Projects

A fork is a GitHub feature that copies another developer’s repository into your own account. The copied repository becomes yours to change freely, while keeping its connection to the original repository (the upstream).

It is used when customizing open source projects or contributing to projects you are interested in.

Prepare Node.js and Git on Mac. Using nvm for Node.js version management is convenient.

nvm install 20    # Install Node.js 20 LTS
nvm use 20        # Select the installed version
node -v           # Check version

Check that Git is available:

git --version

If Git is not installed, install it with brew install git.

  1. Open the repository you want to fork on GitHub
  2. Click the Fork button in the upper-right corner
  3. Select your account, and a copy will be created under your account
  4. If you want to rename the repository, you can do that in Settings

💡 The forked repository remains linked to the original, but changes from the original will not appear in your fork unless you pull them in yourself.

After forking, clone the repository in your account to your local machine.

git clone https://github.com/you/forked_repo.git
cd forked_repo

Register the original repository as upstream so you can pull in later updates.

git remote add upstream https://github.com/someone/original_repo.git
git remote -v

If it is configured correctly, you will see:

origin    https://github.com/you/forked_repo.git (fetch)
origin    https://github.com/you/forked_repo.git (push)
upstream  https://github.com/someone/original_repo.git (fetch)
upstream  https://github.com/someone/original_repo.git (push)

For JavaScript projects, install the dependencies:

npm install
npm run dev   # Start the dev server and verify it works

💡 The command started by npm run dev depends on the project. Check the scripts section of package.json.

Because the forked repository is yours, you can change it freely. For example, if you add content in Markdown, it might look like this:

---
title: "My First Post"
date: "2026-04-01"
---

This is my first post.

After making changes, commit and push them:

git add .
git commit -m "Add content"
git push origin main

If the original repository changes, you can bring those changes into your fork.

git checkout main
git fetch upstream
git merge upstream/main
git push origin main
CommandDescription
git fetch upstreamGet the latest data from the original repository without applying it locally
git merge upstream/mainMerge the fetched changes into your local main
git push origin mainPush the merged result to your GitHub repository

⚠️ If a conflict occurs during merge, fix the relevant file manually, then run git add and git commit.

Contribute Back to the Original Project (Pull Request)

Section titled “Contribute Back to the Original Project (Pull Request)”

If you want to propose your changes to the original project, send a Pull Request.

  1. Push your changes to your repository
  2. Open the original repository on GitHub
  3. Click New pull request
  4. Explain what changed and why
  5. The maintainers review it and merge it if they accept it
OperationCommand
ForkGitHub Fork button
Clonegit clone
Register upstreamgit remote add upstream
Pull in upstream updatesgit fetch upstream -> git merge upstream/main
Push to your repositorygit push origin main

Q. What is the difference between a fork and a clone?

A fork copies a repository on GitHub into your GitHub account. A clone downloads a repository to your local machine. Usually you do “fork -> clone” in that order.

Q. Can I clone without forking?

A: You can work locally after cloning, but you will not have permission to push changes to your own GitHub account unless you fork it first. If you want to manage it as your own repository, you need a fork.

Q. When should I pull upstream updates?

A: Usually before you start working, or when there is a large update in the original project. It is a good habit to run git fetch upstream regularly and check the latest state.