https://www.cnblogs.com/onelikeone/p/6857932.html

1. 这个不是git的规则,而是gerrit的规则,

2. Branches, remote-tracking branches, and tags等等都是对commite的引用(reference),引用都以 “refs/……”表示. 比如remote branch: origin/git_int(=refs/remotes/origin/git_int)local tag: v2.0(=refs/tags/v2.0)local branch: git_int(=refs/heads/git_int)

3. 简单点说,就是refs/for/mybranch需要经过code review之后才可以提交;refs/heads/mybranch不需要code review。

(since you want to directly push into the branch, rather than create code reviews. Pushing to refs/for/* creates code reviews which must be approved and then submitted. Pushing to refs/heads/* bypasses review entirely, and just enters the commits directly into the branch. The latter does not check committer identity, making it appropriate for importing past project history)

如果需要code review,直接push

$git push origin master

那么就会有“! [remote rejected] master -> master (prohibited by Gerrit)”的错误信息

而这样push就没有问题,

$git push origin HEAD:refs/for/mybranch

下面一段是对“refs/for”更详细的描述:

The documentation for Gerrit explains that you push to the “magical refs/for/‘branch’ ref using any Git client tool”.

This image is taken from the Intro to Gerrit. When you push to Gerrit, you do git push gerrit HEAD:refs/for/. This pushes your changes to the staging area (in the diagram, “Pending Changes”). Gerrit doesn’t actually have a branch called ; it lies to the git client.

Internally, Gerrit has it’s own implementation for the Git and SSH stacks. This allows it to provide the “magical” refs/for/ refs.

When a push request is received to create a ref in one of these namespaces Gerrit performs its own logic to update the database, and then lies to the client about the result of the operation. A successful result causes the client to believe that Gerrit has created the ref, but in reality Gerrit hasn’t created the ref at all.

After a successful patch (i.e, the patch has been pushed to Gerrit, [putting it into the “Pending Changes” staging area], reviewed, and the review has passed), Gerrit pushes the change from the “Pending Changes” into the “Authoritative Repository”, calculating which branch to push it into based on the magic it did when you pushed to refs/for/. This way, successfully reviewed patches can be pulled directly from the correct branches of the Authoritative Repository.

关于refs/for/ 和refs/heads/相关推荐

  1. [Git] 关于refs/for/ 和refs/heads/

    转载自: http://lishicongli.blog.163.com/blog/static/146825902013213439500/ 1.     这个不是git的规则,而是gerrit的规 ...

  2. refs win10_Win10创建ReFS文件系统分区教程

    你知道吗?Windows10中隐藏着一种神秘的ReFS文件系统,ReFS分区可以更可靠稳定地储存数据.但是由于ReFS文件系统的特殊性,所以想要创建ReFS分区不能像常规的Win10硬盘分区那样来实现 ...

  3. refs win10_win10系统ReFS 3.2分区的操作方法

    很多小伙伴都遇到过对 Win10创意者 1.准备一个空白的分区,这里以K盘为例: 2.按下[Win+R]打开运行,输入:regedit 点击确定打开注册表: 3.在注册表左侧依次展开:HKEY_LOC ...

  4. refs win10_在refs格式下可不可以装windows 10

    在refs格式下 能装windows 10 方法一:出现上述问题后,直接把U盘拔掉插到其它电脑,把U盘里的efi文件夹和bootmgr.efi文件删掉,问题就搞定了,然后,再用这个U盘启动盘去装系统, ...

  5. gerrit refs相关的一些小研究

    gerrit 作为 code review使用不算难,然鹅,总有一些内容知其然不知其所以然,这里稍作研究和记录. 1. refs/for 和 refs/heads 向gerrit服务器提交代码命令: ...

  6. gerrit refs相关的一些研究

    gerrit 作为 code review使用不算难,然鹅,总有一些内容知其然不知其所以然,这里稍作研究和记录. 1. refs/for 和 refs/heads 向gerrit服务器提交代码命令: ...

  7. this. $ refs: undefined 的解决办法

    vue this.$refs.tree.setCheckedKeys(list) 不能用的解决办法 代码 this.$refs.tree1.setCheckedKeys(list); //通过 id ...

  8. Windows 10如何启用ReFS弹性文件系统

    责任编辑:editor005 |  2016-10-10 14:26:56 本文摘自:51CTO 自微软为 Windows 操作系统定制和设计 NTFS 文件系统之后,用户的数据存储需求还是发生的巨大 ...

  9. reactJS -- 9 组件的Refs(操作DOM的两种方法)

    2019独角兽企业重金招聘Python工程师标准>>> 一.概述 https://react-cn.github.io/react/docs/more-about-refs.html ...

最新文章

  1. 植树节特别活动:合种樟子松/华山松/云杉/胡杨
  2. python的语法结构_Python特点、语法结构、编码知识
  3. python培训中心-【北京Python培训中心】
  4. TradingView 初识
  5. 对话智能新高度:全面解读百度开放域对话模型PLATO
  6. Stateflow如何观察变量的变化
  7. sitemesh3.0的配置以及在静态html中的使用
  8. python版trace命令显示归属地
  9. java.io.ioexception 拒绝访问,IOException异常 - 拒绝访问使用FileOutputStream中
  10. centos 6.8安装git_git 入门教程之 git 私服搭建教程
  11. jspdf 分页_使用html2canvas跟jspdf导出导出PDF文件
  12. ASN.1编解码:asn1c-ORAN-E2AP
  13. princomp 与pca的区别与联系
  14. 21天Jenkins打卡Day6安装插件
  15. 与孩子一起学编程07章
  16. 单片机基础学-按键篇
  17. iptables指南
  18. Aegisub制作字幕从入门到精通:制作srt字幕,制作ass字幕,压制字幕和视频
  19. DWZ 富文本编辑器 IE下失去焦点
  20. 计算机硬盘格式化与储存原理

热门文章

  1. Science:病原菌激活植物内生菌群的抑病功能
  2. 818专业课【考经】—《信号系统》之章节概要:第五章 连续时间信号的变换域分析
  3. HTTP 请求报文 组成部分和特点 及实现功能
  4. 【BOSS说】订单月环比增加15%,危机反而强化了闪送的三个竞争壁垒
  5. 用 DiskGenius 修复 U 盘
  6. 机器学习:学习k-近邻(KNN)模型建立、使用和评价
  7. CPU profiler(gperftools)在嵌入式系统上的应用示例
  8. 比scp更强大的复制命令rsync
  9. sa8295 yocto 编译问题
  10. php浅蓝色英文,浅蓝色HTML5宽屏大气企业模板