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腳本。