Fork,本身并不是git工具中的一个命令,也不是对git的扩展,它是在GitHub上的概念,是另一种clone方式——在服务器端的clone
而我们通常意义上的clone,是将远程repo 复制一份到本地。

当你从GitHub上 clone 一个 repo 到本地时,除非你已明确声明是这个repo的contributor,否则你是不能向其pull request的,此时,该远程的repo对于本地repo来说,就是upstream。
当你从GitHub上 fork 一个 repo 之后,再 clone forked repo 到本地,你就可以任意向其pull request,此时,远程的 repo 就是 origin。

下面一段是来自 GitHub pages 的解释:

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.com/user/repo_name.git

总结下来: 
1. 如果是 upstream repo,你只可以拉取最新代码(即 git fetch ),从而保证你本地的仓库与源仓库同步 
2. 如果是 origin repo,就是你自己的repo(自己创建的,或者 fork 的项目)你可以做 任何推拉操作(pull and push) 
3. 你可以通过 pull request 向 upstream repo 贡献代码

Referenced by http://stackoverflow.com/questions/6286571/git-fork-is-git-clone

In terms of source control, you're "downstream" when you copy (clone, checkout, etc) from a repository. Information flowed "downstream" to you.

When you make changes, you usually want to send them back "upstream" so they make it into that repository so that everyone pulling from the same source is working with all the same changes. This is mostly a social issue of how everyone can coordinate their work rather than a technical requirement of source control. You want to get your changes into the main project so you're not tracking divergent lines of development.

Sometimes you'll read about package or release managers (the people, not the tool) talking about submitting changes to "upstream". That usually means they had to adjust the original sources so they could create a package for their system. They don't want to keep making those changes, so if they send them "upstream" to the original source, they shouldn't have to deal with the same issue in the next release.

http://stackoverflow.com/questions/2739376/definition-of-downstream-and-upstream/2749166#2749166

What is the difference between origin and upstream in 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.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).

You will use origin to pull and push since you can contribute to your own repo.

You will contribute back to the upstream repo by making a pull request.

http://my.oschina.net/uniquejava/blog/481625

github中origin和upstream的区别(转)相关推荐

  1. 【转】github中origin和upstream的区别

    Fork,本身并不是git工具中的一个命令,也不是对git的扩展,它是在GitHub上的概念,是另一种clone方式--在服务器端的clone. 而我们通常意义上的clone,是将远程repo 复制一 ...

  2. HTTP中Origin和Referer的区别?

    一.简介 HTTP 协议,用 Header 中的 Origin 和 Referer 来表示请求链接的来源,他们在使用上有些区别. 二.Origin 详解 Origin 指示了请求来自于哪个站点,只有服 ...

  3. github中clone代码到本地与直接下载压缩包的区别

    今天想要在是使用git在github中clone一个工具包到本地,但是网速太慢,一直没办法正常clone,于是就思考clone代码与直接下载zip包有什么区别呢? clone代码到本地仓库是有一个.g ...

  4. 输入‘git push origin master‘不弹出账号密码输入框?(把本地Git中的代码push到Github中)

    注意:         Github从 2021 年 8 月 13 日开始,在 GitHub.com 上对 Git 操作进行身份验证时,将不再接受帐户密码,改用tokens验证. 点此查看官网公告   ...

  5. java中的wait和sleep_java中wait和sleep的区别

    java中wait和sleep的区别 在本篇文章中,我们将会讨论一下java中wait()和sleep()方法的区别.并讨论一下怎么使用这两个方法. Wait和sleep的区别 wait() 是Obj ...

  6. 【Java】泛型中 extends 和 super 的区别?

    <? extends T>和<? super T>是Java泛型中的"通配符(Wildcards)"和"边界(Bounds)"的概念. ...

  7. Python 中各种imread函数的区别与联系

    Python 中各种imread函数的区别与联系 最近一直在用python做图像处理相关的东西,被各种imread函数搞得很头疼,因此今天决定将这些imread总结一下,以免以后因此犯些愚蠢的错误.如 ...

  8. vue方法调用失败后多次调用_浅析Vue中 computed / watch / methods的区别

    思考:请说下Vue中computed 和 watch 的区别( 面试题 ) 构造选项 computed / watch / methods computed ● computed 起初构想 在Vue的 ...

  9. java中Runnable和Callable的区别

    文章目录 运行机制 返回值的不同 Exception处理 java中Runnable和Callable的区别 在java的多线程开发中Runnable一直以来都是多线程的核心,而Callable是ja ...

最新文章

  1. 如何在RHEV平台中新建ISO存储域
  2. 你还记得windows workflow foundation吗
  3. 从wireshake分析http和https的通信过程
  4. Swoole HTTP 的应用
  5. 高性能MySQL-3rd-(五)创建高性能索引
  6. React Suite 组件库
  7. CentOS7 添加端口
  8. LINUX编译OpenJDK8:cc1plus: all warnings being treated as errors
  9. Contacts Provider基础
  10. echarts地图显示问题
  11. 个人打造sm2258xt固态U盘全过程分享,附量产工具和教程
  12. Netty 是什么,Netty原理详解
  13. 神舟笔记本键盘键位互换
  14. 一般学校计算机密码是什么,学校电脑密码忘了怎么解?
  15. 绘制盐沼植被图的混合方法-文献阅读
  16. 华为畅享8plus停产了吗_华为畅享8和Plus哪个好? 华为畅享8 Plus与畅享8区别对比评测...
  17. 计算机启动时滴滴两声,电脑开机时出现滴滴两声后,不能开机,怎么回事。
  18. 用ps提取彩色图像的线稿
  19. H5拖拽地址-高德地图VUE版
  20. 《计算机寓言 - 信息时代的启示》(转载)

热门文章

  1. C/C++中.和-的用法区别
  2. Eigen 模板库的简介
  3. ROS Gazebo(一):安装与使用
  4. Mycat简单实现读写分离与分库分表
  5. 我使用的PhpStorm_已迁移
  6. PHP解决方案@时间戳与时间日期
  7. 炙手可热的前端资源大集合
  8. 11月份是个少产的季节
  9. 噩耗...............
  10. HTML5之article元素与section元素之间的区别?