GitHub上的起源和上游之间有什么区别?

编程入门 行业动态 更新时间:2024-10-27 02:17:25
本文介绍了GitHub上的起源和上游之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在来源和上游之间有什么区别 / 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/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 on upstream 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 named upstream

git remote add upstream git://github/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上的起源和上游之间有什么区别?

本文发布于:2023-10-08 02:24:59,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:有什么区别   起源   GitHub

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!