github中origin和upstream的区别(转)
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的区别(转)的更多相关文章
- github中fork分支和pullrequest的最佳实践
github中fork分支和pullrequest的最佳实践 */--> code {color: #FF0000} pre.src {background-color: #002b36; co ...
- JS中isPrototypeOf 和hasOwnProperty 的区别 ------- js使用in和hasOwnProperty获取对象属性的区别
JS中isPrototypeOf 和hasOwnProperty 的区别 1.isPrototypeOf isPrototypeOf是用来判断指定对象object1是否存在于另一个对象object2的 ...
- (转)如何将本地git仓库上传到GitHub中托管+实践心得
Git——新手入门与上传项目到远程仓库GitHub(转) - Chen_s - 博客园http://www.cnblogs.com/Chenshuai7/p/5486278.html 注意的问题: 1 ...
- DOM 中 Property 和 Attribute 的区别
原文地址:http://web.jobbole.com/83129/ property 和 attribute非常容易混淆,两个单词的中文翻译也都非常相近(property:属性,attribute: ...
- 对github中项目进行更新
进入本地仓库文件夹,我的仓库名是tufujiegit,然后 进入 git clone 接着将先前记录下来的地址复制到后面,回车 将下载github中该仓库的所有文件及文件夹,包括.git文件夹在内 ...
- git使用方法----如何利用git管理代码?如何使用git将代码传到github中去
## 在文件夹中打开 git here; 1.git init ===初始化一个仓库(这个仓库会存放,git对我们代码进行备份的文件)2.配置个人信息 -- --在git中设置当前使用的用户是==( ...
- 如何在Github中删除已有仓库或文件
一.删除已有仓库如果我们想要删除Github中没有用的仓库,应该如何去做呢? 进入到我们需要删除的仓库里面,找到“settings”即仓库设置: 然后,在仓库设置里拉到最底部,找到“Danger Zo ...
- git生成Key操作保存到GITHUB中
https://blog.csdn.net/sinat_23880167/article/details/78502528 1. 在git中通过命令: $ ssh-keygen Generating ...
- Github 中提交项目到自己仓库的 gh-pages 分支
Github 中提交项目到自己仓库的gh-pages分支 cd cnblogs-theme/ git init git remote add origin git@github.com:hglibin ...
随机推荐
- Atitit. .net c# web 跟clientwinform 的ui控件结构比較
Atitit. .net c# web 跟clientwinform 的ui控件结构比較 .net 4.5 webform Winform 命名空间 System.Web.UI.WebContro ...
- Java笔试题1
1. 下面的代码执行后,什么结果输出是? String s1 = new String("Test"); String s2 = new String("Test&quo ...
- mediator pattern
20.4 中介者模式总结 中介者模式将一个网状的系统结构变成一个以中介者对象为中心的星形结构,在这个星型结构中,使用中介者对象与其他对象的一对多关系来取代原有对象之间的多对多关系.中介者模式在事件驱动 ...
- LoadRunner获取一个独特的价值在执行的场景
/* * * 笔者:古柏涛 * 迄今:2015-2-26 * E-mail:gubotao@foxmail.com * * 内容概要: * 本代码产生一个从1970年1月1日0时開始累计以毫秒为单位的 ...
- android 网络运营商的名字显示规则(锁定屏幕,下拉列表)
一:Background & 有关flow MTK Operator name display分为两种类型的手机: 1. Sim卡名称: 从基于引导SIM卡读取IMSI到Spn-conf.xm ...
- js多个物体运动的问题1
问题2 http://www.cnblogs.com/huaci/p/3854304.html 用js写一个物体的运动很简单.如果一个页面有多个物体在运动,它会不会出问题呢? ok,我们来看一个示例 ...
- 剖析html对标准标签和自定义标签闭合与不闭合渲染问题
昨天在修改去年写的系统的时候无意中看到了当时写的一个利用标准标签未闭合在单元格内把整个单元格颜色渲染成红色的效果,如下: 当时的问题是从后台返回来的是个int整数而%是写在页面上的如图 这 时候就出现 ...
- Java中使用Lua脚本语言(转)
Lua是一个实用的脚本语言,相对于Python来说,比较小巧,但它功能并不逊色,特别是在游戏开发中非常实用(WoW采用的就是Lua作为脚本的).Lua在C\C++的实现我就不多说了,网上随便一搜,到处 ...
- Android - 支持不同的设备 - 支持不同的屏幕
Android整体上按照两大类来分类设备屏幕:尺寸和分辨率.app在设备上运行应该考虑大小和分辨率.同样的,你应该包含不同的资源来让app适应不同的屏幕大小和分辨率. 整体上有四种尺寸:小的,正常的, ...
- 【原创】构建高性能ASP.NET站点 第五章—性能调优综述(后篇)
原文:[原创]构建高性能ASP.NET站点 第五章-性能调优综述(后篇) 构建高性能ASP.NET站点 第五章—性能调优综述(后篇) 前言:本篇主要讲述如何根据一些简单的工具和简单的现象来粗布的定位站 ...