git commit 不生成 changeId 解决方案
1). 检查仓储 .git/hook 下面是否有 commit-msg 文件,如果没有可以到下面的地址下载,或者把其他同事的 commit-msg 文件拷贝到你的 .git/hook 重新commit即可。
http://review.cyanogenmod.org/tools/hooks/commit-msg
https://gerrit-review.googlesource.com/tools/hooks/commit-msg
如果有自己的gerrit-review服务器,可以直接在网址后面加上 /tools/hooks/commit-msg 即可下载。
添加后,每次执行git commit 都会自动在log里面生成 Change-Id,用于gerrit code review。
注意:下载 commit-msg 需要设置执行权限:#chmod a+x .git/hook/commit-msg
2). 如果是repo sync 下来的代码,随便找一个仓储,按上面的方法,检查是否存在 commit-msg 软链接(repo sync 是在每个仓储.git/hooks下面创建的软链接),如果不存在,修改工程目录下面 .repo/manifest.xml
,注意这个xml文件也是软链接。
<remote name="aosp" review="review.source.android.com" fetch=".." />
<default revision="master" remote="aosp" sync-j="4" />
注意必须添加上面的 review="review.source.android.com"
这句。至于为什么,可以查看.repo/repo 下面的 python脚本。
附: commit-msg
#!/bin/sh
# From Gerrit Code Review 3.6.0-rc4-360-g5a87dddd18
#
# Part of Gerrit Code Review (https://www.gerritcodereview.com/)
#
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -u
# avoid [[ which is not POSIX sh.
if test "$#" != 1 ; then
echo "$0 requires an argument."
exit 1
fi
if test ! -f "$1" ; then
echo "file does not exist: $1"
exit 1
fi
# Do not create a change id if requested
if test "false" = "$(git config --bool --get gerrit.createChangeId)" ; then
exit 0
fi
if git rev-parse --verify HEAD >/dev/null 2>&1; then
refhash="$(git rev-parse HEAD)"
else
refhash="$(git hash-object -t tree /dev/null)"
fi
random=$({ git var GIT_COMMITTER_IDENT ; echo "$refhash" ; cat "$1"; } | git hash-object --stdin)
dest="$1.tmp.${random}"
trap 'rm -f "${dest}"' EXIT
if ! git stripspace --strip-comments < "$1" > "${dest}" ; then
echo "cannot strip comments from $1"
exit 1
fi
if test ! -s "${dest}" ; then
echo "file is empty: $1"
exit 1
fi
reviewurl="$(git config --get gerrit.reviewUrl)"
if test -n "${reviewurl}" ; then
if ! git interpret-trailers --parse < "$1" | grep -q '^Link:.*/id/I[0-9a-f]\{40\}$' ; then
if ! git interpret-trailers \
--trailer "Link: ${reviewurl%/}/id/I${random}" < "$1" > "${dest}" ; then
echo "cannot insert link footer in $1"
exit 1
fi
fi
else
# Avoid the --in-place option which only appeared in Git 2.8
# Avoid the --if-exists option which only appeared in Git 2.15
if ! git -c trailer.ifexists=doNothing interpret-trailers \
--trailer "Change-Id: I${random}" < "$1" > "${dest}" ; then
echo "cannot insert change-id line in $1"
exit 1
fi
fi
if ! mv "${dest}" "$1" ; then
echo "cannot mv ${dest} to $1"
exit 1
fi
git commit 不生成 changeId 解决方案的更多相关文章
- Git 提交(commit)没有自动生成Change-Id导致无法push
1). 检查仓储 .git/hook 下面是否有 commit-msg 文件,如果没有可以到下面的地址下载,或者把其他同事的commit-msg文件拷贝到你的.git/hook重新commit即可. ...
- git push ERROR: missing Change-Id in commit message footer
今天上传代码时候报告错误:$ git push origin HEAD:refs/for/branch*Counting objects: 7, done.Delta compression usin ...
- 如何写好 Git commit messages
导语:任何软件项目都是一个协作项目,它至少需要2个开发人员参与,当原始的开发人员将项目开发几个星期或者几个月之后,项目步入正规.不过他们或者后续的开发人员仍然需要经常提交一些代码去修复bug或者实现新 ...
- Git commit message和工作流规范
目的 统一团队Git commit日志标准,便于后续代码review,版本发布以及日志自动化生成等等. 统一团队的Git工作流,包括分支使用.tag规范.issue等 Git commit日志参考案例 ...
- git commit 、CHANGELOG 和版本发布的标准自动化
一直以来,因为团队项目迭代节奏很快,每次发布的更新日志和版本更新都是通过人肉来完成的.有时候实在忙的团团转,对于手动的写这些更新信息就显得力不从心了.对于团队新来的小伙伴,有时候遇到些紧急情况,就更显 ...
- 规范git commit提交记录和版本发布记录
在开发过程中我们一般都会用到git管理代码,在git commit提交代码时我们一般对git commit message随便写点简单的描述,可是随着项目参与人数的增多,发现提交的commit记录越来 ...
- git commit前检测husky与pre-commit 提交钩子
git commit前检测husky与pre-commit git commit前检测husky与pre-commit - 简书 https://www.jianshu.com/p/f0d31f92b ...
- linux显示git commit id,同时解决insmod模块时版本不一致导致无法加载问题
linux内核默认会包含git的commit ID. 而linux的内核在insmod模块时,会对模块和内核本身的版本做严格的校验.在开发产品时,改动内核后,由于commit ID变更,会导致linu ...
- python解析git log后生成页面显示git更新日志信息
使用git log可以查到git上项目的更新日志. 如下两个git项目,我想把git的日志信息解析成一个便于在浏览器上查看的页面. https://github.com/gityf/lua https ...
- [译]git commit --amend
git commit --amend命令用来修复最近一次commit. 可以让你合并你缓存区的修改和上一次commit, 而不是提交一个新的快照. 还可以用来编辑上一次的commit描述. 记住ame ...
随机推荐
- [转帖]Ubuntu Server安装图形界面
最早接触到的Linux系统是Ubuntu 10.04,当时在自己的一台Win7笔记本电脑上安装的Win/Ubuntu双系统,Ubuntu简洁的操作界面给我留下了深刻的印象. 后来开始做一些服务器开发, ...
- [转帖]Nginx(2):架构设计与工作流程
https://cloud.tencent.com/developer/article/1886166?areaSource=&traceId= 这些天呐,实在是给我看晕了.起因自然还是对 n ...
- Linux 下面删除指定日期之前文件的办法
1. Linux 下面最近有一个需求 需要只更新2020年4月10号之后补丁的需求 2. rsync 能够拉取所有的补丁文件 没找到能够按照日期进行拉取的办法. 所以想了一个折中的办法 先拉取 再按 ...
- 强化学习技巧四:模型训练速度过慢、GPU利用率较低,CPU利用率很低问题总结与分析。
1.PyTorchGPU利用率较低问题原因: 在服务器端或者本地pc端, 输入nvidia-smi 来观察显卡的GPU内存占用率(Memory-Usage),显卡的GPU利用率(GPU-util),然 ...
- python处理Excel实现自动化办公教学(数据筛选、公式操作、单元格拆分合并、冻结窗口、图表绘制等)【三】
相关文章: python处理Excel实现自动化办公教学(含实战)[一] python处理Excel实现自动化办公教学(含实战)[二] python处理Excel实现自动化办公教学(数据筛选.公式操作 ...
- 8.9 RDTSC时钟检测反调试
RDTSC时钟检测同样可实现反调试检测,使用时钟检测方法是利用rdtsc汇编指令,它返回至系统重新启动以来的时钟数,并且将其作为一个64位的值存入EDX:EAX寄存器中,通过运行两次rdstc指令,然 ...
- P9989 [Ynoi Easy Round 2023] TEST_69 题解
题目链接: [Ynoi Easy Round 2023] TEST_69 首先GCD有比较良好的一些性质.我们观察到一次 \(GCD(a_i,x)\) 操作,会有以下两种变化. 如果 \(x \bmo ...
- ASCII、Unicode、UTF8 10年后,史无前例,自己用js实现《专题3》
我自己史无前例的开发了一个网页小工具,可以利用这个工具 直接查询到 一个字符的unicode二进制的定义,和utf8格式下内存中 存储的二进制. =========================== ...
- Python脚本的输入输出
一.必备知识回顾和补充 1. Hello world回顾 1.输出文本,使用print函数输出文本. 2.让用户输入名字,然后输出带名字的问候语.使用input函数获取用户的输入,使用变量保存输入值. ...
- 【架构师视角系列】QConfig配置中心系列之架构设计(一)
目录 声明 配置中心系列文章 一.架构 基础模型 架构图 架构分层 运行规则 模块划分 Admin模块 Client模块 Server模块 二.总结 三.最后 声明 原创文章,转载请标注.https: ...