转载自: http://lishicongli.blog.163.com/blog/static/146825902013213439500/

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/<BRANCH>. This pushes your changes to the staging area (in the diagram, "Pending Changes"). Gerrit doesn't actually have a branch called <BRANCH>; 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/<BRANCH> 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/<BRANCH>. This way, successfully reviewed patches can be pulled directly from the correct branches of the Authoritative Repository.

转载于:https://www.cnblogs.com/0616--ataozhijia/p/4165052.html

[Git] 关于refs/for/ 和refs/heads/相关推荐

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

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

  2. 关于refs/for/ 和refs/heads/

    https://www.cnblogs.com/onelikeone/p/6857932.html 1. 这个不是git的规则,而是gerrit的规则, 2. Branches, remote-tra ...

  3. Git CMD - push: Update remote refs along with associated objects

    命令格式 git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pac ...

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

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

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

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

  6. git refs/for 命令

    命令 git push origin HEAD:refs/for/xxx 形式 git push <remote 名字> <本地分支的名字> : <远程库的名字> ...

  7. git push error report: ! [remote rejected] master - refs/for/master (no new changes)

    merge 使用这个命令 git merge --no-commit --no-ff branch 然后commit .push git push出现unpack failed: error Miss ...

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

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

  9. gerrit refs相关的一些研究

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

最新文章

  1. php数组转xml文件,php数组转换成xml格式的实现方法
  2. java面向对象知识汇总的思维导图
  3. freeCodeCamp 学习记录——初级算法「01」翻转字符串
  4. 详解中奖概率逻辑:为什么你中不了特等奖(附原件)
  5. vb 计算圆环上每一点的坐标_工程土方量计算比较分析
  6. sql 替换字段中的部分字符,替换指定字符
  7. 基于显著性检验分析两个样本分布相似度及Python实现—— t检验、拟合优度检验、KS检验、Wilcoxon符号秩检验、H检验、Mann-Whitney秩检验、P值的意义、API汇总
  8. Gym100015 I Identity Checker 栈容器使用,数学
  9. 【hihocoder 1477】闰秒
  10. 七自由度机械臂设计分析——待更新
  11. Linux shell:sh csh tcsh ash bash dash zsh
  12. 圈叉棋、套娃圈叉棋、嵌套圈叉棋、九个井字棋
  13. NOI Online 2020 Round1 准备计划
  14. 《ZigBee开发笔记》第五部分 外设篇 - 基础实验 第2章 CC2530温湿度传感器DHT11
  15. 【计算机基础】进制转换
  16. 盖茨、马斯克都遵循的终身学习法则:知识不是由学科划分的
  17. 你知道旧金山名称的由来么?
  18. 微波——导引波(三)
  19. 复选框如何实现单选框效果
  20. 使用Git将文件上传到暂存区

热门文章

  1. 【转】Windows IIS注册asp 此操作系统版本不支持此选项 错误解决方法
  2. 一种解决Android studio 3.0 Build报错的方法
  3. 如何从标签创建新分支?
  4. 找到的程序集的清单定义与程序集引用不匹配
  5. win11任务栏怎么设置大小
  6. linux能记录日志的终端,如何记录Linux终端下的操作日志
  7. python编程老师岗位需求表_教师岗位需求信息表
  8. 贪吃蛇c语言代码高难,100多行代码的《贪吃蛇》
  9. C语言将raw转为bmp,RAW格式数据转BMP格式数据
  10. uniapp中利用监视vuex中state数据配合uview实现登录消息提示