Upstream
一句话解释
Upstream 是 conventional name for remote pointing 到原始仓库你 forked 从.
用大白话说
当你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: 原点 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 获取 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 分支" means the remote branch your local branch tracks.
示例
# 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 forkupstream 点到 原始仓库; 获取 and 合并到 sync 你的 Fork.
相关术语
相关资源
相关课程
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。