[Git] 关于refs/for/ 和refs/heads/
转载自: 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.
[Git] 关于refs/for/ 和refs/heads/的更多相关文章
- 关于refs/for/ 和refs/heads/
1. 这个不是git的规则,而是gerrit的规则, 2. Branches, remote-tracking branches, and tags等等都是对commite的引用(re ...
- git:hook declined FATAL: W refs/heads DENIED by fallthru error
hook declined FATAL: W refs/heads DENIED by fallthru error git提交代码时报错,网上查了,最终结果竟然是测试人员没有给我配置写的权限,配置了 ...
- Git CMD - push: Update remote refs along with associated objects
命令格式 git push [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pac ...
- git fail to push some refs....
出现错误的主要原因是github中的README.md文件不在本地代码目录中 可以通过如下命令进行代码合并[注:pull=fetch+merge] git pull --rebase origin m ...
- git报错error: src refspec refs/heads/master does not match any.
$ git pusherror: src refspec refs/heads/master does not match any.error: failed to push some refs 出错 ...
- Git远程分支和refs文件具体解释
推送远程分支到同一个server 比方首先建立gitserver,顺便clone出两个副本 mkdir server cd server git init --bare cd .. git clone ...
- bad object refs/remotes/origin/HEAD
How to handle git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack I random ...
- react中的refs
概述 很久之前就知道refs,感觉好神秘,恰好今天突然发现字符串形式的ref在官网不推荐使用了,于是好好总结一下ref的用法,供以后开发时参考,相信对其他人也有用. 参考资料: Refs & ...
- Refs & DOM
Refs 提供了一种访问在 render 方法中创建的 DOM 节点或 React 元素的方式. 在典型的 React 数据流中, 属性(props)是父组件与子代交互的唯一方式.要修改子组件,你需要 ...
随机推荐
- 51nod 拉勾专业算法能力测评消灭兔子 优先队列+贪心
题目传送门 这道题一开始想了很久...还想着写网络流 发现根本不可能.... 然后就想着线段树维护然后二分什么的 最后发现优先队列就可以了 代码还是很简洁的啦 233 就是把兔子按血量从大到小排序一下 ...
- [目前未找到题目]扩展KMP模板
procedure build_next; begin lena:=length(a);lenb:=length(b); next[]:=lenb;next[]:=lenb-; to lenb- ] ...
- 鼠标DPI和液晶显示器分辨率的关系
鼠标DPI和液晶显示器分辨率的关系 说起鼠标,有两个性能指标是我们不能忽略的.一是游戏玩家相当熟悉的扫描率(单位:Frames Per Second),二是我们今天要和大家探讨的鼠标的分辨率(单位:D ...
- Linux 格式化磁盘命令mkfs
linux格式化磁盘命令 mkfs 指令:mkfs 使用权限 : 超级使用者 使用方式 : mkfs [-V] [-t fstype] [fs-options] f ...
- 关闭浏览器session就被干掉的假象的问题
当在前台取出session时,关闭浏览器后再次访问服务器,这时服务器返回了一个null,此时的返回的session并非之前的那个session而是一个新的session. -->先来看看sess ...
- 虚拟机Visualbox安装Ubuntu Server
关于虚拟机的新建及设置,请查看<Visualbox安装Ubuntu网络设置> 从光盘启动系统中,首先是选择语言,我这里选择英文 选择英文安装Ubuntu服务器 继续选择英文 选择地理位置, ...
- error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
http://stackoverflow.com/questions/11990708/error-cant-connect-to-local-mysql-server-through-socket- ...
- HDU 6273.Master of GCD-差分数组 (2017中国大学生程序设计竞赛-杭州站-重现赛(感谢浙江理工))
Super-palindrome 题面地址:http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf 这道题是差分数组的题目,线 ...
- Codeforces 702A Maximum Increase(dp)
题目链接:http://codeforces.com/problemset/problem/702/A 题意: 给你N个数,a[0], a[1], a[2], ....., a[n-1],让你找出最长 ...
- Golang基础入门
Go语言很容易上手 第一步,在你的计算机上安装Go语言环境 首先下载对应操作系统的安装包或者源文件 Windows和Mac OSX 都有安装包,可以选择直接双击安装,很简单 Ubuntu系统可以使用 ...