Skip to content

Upstream

In one line

Upstream is the conventional name for the remote pointing to the original repository you forked from.

In simple words

When you fork a repository, your fork is a copy under your account. The original repository is called "upstream." Adding it as a remote lets you fetch changes from the original to keep your fork in sync.

The typical setup: origin points to your fork (where you have write access and push to), upstream points to the original (where you fetch from but cannot push to). Periodically, you git fetch upstream and merge its changes into your fork to stay current.

"Upstream" can also refer to the direction of data flow in Git: pushing sends data upstream to the remote, pulling brings data downstream from the remote. In branch tracking, "upstream branch" means the remote branch your local branch tracks.

Example

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

# Fetch changes from upstream
git fetch upstream

# Merge upstream changes into your local main
git checkout main
git merge upstream/main
git push origin main  # push to your fork

upstream points to the original repo; fetch and merge to sync your fork.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary