GitHub上的起源和上游之间有什么区别? [英] What is the difference between origin and upstream on GitHub?
问题描述
在来源和上游
之间有什么区别.org / wiki / GitHub> GitHub ?
当 git branch -a
命令是完成后,一些分支的前缀为 origin
( remotes / origin /..
),而其他分支的前缀为 upstream
( remotes / upstream /..
)。
这应该在 GitHub叉子 (在GitHub上分叉GitHub仓库之前,先在本地克隆该分叉)
-
上游
通常是指您已分叉的原始库存
(另请参阅下游
和上游
的定义更多关于上游
term) -
origin
您自己的GitHub回购,GitHub原始回购克隆
从GitHub页面:
当克隆repo时,它有一个默认远程名为
origin
的指向您在GitHub上的叉,而不是原始repo它被分出来。
为了跟踪原始的repo,你需要添加另一个名为upstream的远程
git remote add upstream git://github.com/user/repo.git
您将使用上游
从原始回购取回 (为了保持你的本地副本与你想贡献的项目同步)。
pre $ g $ f $ g $ $ $ $ $ $ $ b
( git fetch
可以从 origin
默认情况下,这不是在这里需要的)
您将使用 origin
改为拉和推你可以贡献自己的回购。
git pull
肠道推送
(同样,没有参数,默认使用'origin')
通过制作 上游回购=noreferrer>拉取请求 。
What is the difference between origin
and upstream
on GitHub?
When a git branch -a
command is done, some branches have a prefix of origin
(remotes/origin/..
) while others have a prefix of upstream
(remotes/upstream/..
).
This should be understood in the context of GitHub forks (where you fork a GitHub repo at GitHub before cloning that fork locally)
upstream
generally refers to the original repo that you have forked
(see also "Definition of "downstream
" and "upstream
"" for more onupstream
term)origin
is your fork: your own repo on GitHub, clone of the original repo of GitHub
From the GitHub page:
When a repo is cloned, it has a default remote called
origin
that points to your fork on GitHub, not the original repo it was forked from.
To keep track of the original repo, you need to add another remote namedupstream
git remote add upstream git://github.com/user/repo.git
You will use upstream
to fetch from the original repo (in order to keep your local copy in sync with the project you want to contribute to).
git fetch upstream
(git fetch
alone would fetch from origin
by default, which is not what is needed here)
You will use origin
to pull and push since you can contribute to your own repo.
git pull
gut push
(again, without parameters, 'origin' is used by default)
You will contribute back to the upstream
repo by making a pull request.
这篇关于GitHub上的起源和上游之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!