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. CSS3关于过渡效果的问题
  2. requirejs模块化html,requirejs模块化-入门
  3. 【数论】数论基础合集
  4. 2019-4-23 plan
  5. 经典的printk 写法
  6. csv文件简介(转载)
  7. DelegateModelGroup QML类型
  8. rabbitmq怎么停止_如何停止从选择性队列中消费消息 – RabbitMQ
  9. 你知道怎么使用DebugView查看调试信息吗?
  10. 别忘了当初你为何出发
  11. Bash脚本删除相对路径下小于指定大小的文件
  12. 数字信号处理——DFT的一些理解
  13. 己所不欲,勿施于人的意思,这句话出自哪里?
  14. java版我的世界光追,老瓶装新酒 光追版《我的世界》将至你心动了吗
  15. Apache http server2.4 64位绿色解压版的安装、部署、启动和使用说明
  16. [core java学习笔记][第十一章异常断言日志调试]
  17. 网页游戏用的什么编程语言
  18. wpsmac和pc版的区别_办公得力小助手你选谁, WPS Mac版和Microsoft区别在哪里?
  19. Android 字体库的使用-引入外部字体
  20. #91;#12304;#26469;#20998;#26399;#23458;#26381;#30005;#35805;#12305;#93;

热门文章

  1. csharp:Nhibernate Procedure with CreateSQLQuery and GetNamedQuery
  2. 模块导入以及书写规则
  3. 从使用到原理学习Java线程池
  4. 单元测试原来是这样的呼
  5. iOS 开发疑难杂症(01)
  6. 方法的重载(overload)和重写(override)的区别
  7. 2014腾讯实习生招聘软件开发类附加题
  8. 用OpenMP加速你的程序[转]
  9. 复盘二进制的习题(2)
  10. 【数据结构与算法】【算法思想】位图