[英]Add Change-Id to previous commit
我有很多承诺。 但是我的最后一次提交没有Change-Id。 不能推到格里特。
如何将Change-Id添加到先前的提交?
首先,您需要安装“ commit-msg”挂钩,该挂钩负责将Change-Ids自动添加到提交中。 要安装并了解有关钩子的更多信息,请参见Gerrit文档中的commit-msg Hook项。
要更改您的最后一次提交,只需执行:
git commit --amend
或者,您可以将Change-Id手动添加到提交消息中。 只需添加以下行即可提交消息页脚:
Change-Id: Ic8aaa0728a43936cd4c6e1ed590e01ba8f0fbf5b
随机更改一些更改标识号,并在开头保留“ I”。
Gerrit提供了一个commit-msg
挂钩脚本 ,该脚本将自动向您的提交添加更改ID。
我链接到的文档提供了安装说明:
要获取commit-msg脚本,请使用scp,wget或curl将其从Gerrit服务器下载到本地系统。
您可以使用以下任一命令:
$ scp -p -P 29418 <your username>@<your Gerrit review server>:hooks/commit-msg <local path to your git>/.git/hooks/ $ curl -Lo <local path to your git>/.git/hooks/commit-msg <your Gerrit http URL>/tools/hooks/commit-msg
一旦安装了commit-msg
钩子,就可以使用git commit --amend
更新您的提交消息。 当您保存它时,该挂钩会将Change-Id
添加到消息中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.