![](/img/trans.png)
[英]Is it possible to save a git commit message to a file in a pre-commit hook?
[英]git: how to obtain the commit message of the file before it gets committed using pre-commit hook?
我正在處理一個鈎子腳本,以獲取當前正在提交的文件的提交消息,並更改提交消息,然后提交,如果它不滿足模式。
我的問題是,有沒有辦法在提交之前獲取文件的提交消息並更改提交消息然后提交文件?
pre-commit
鈎子旨在檢查提交的內容而不是提交消息。
您可能正在尋找prepare-commit-msg
掛鈎或更可能是commit-msg
掛鈎來更改提交消息。
以下是與提交操作相關的有序掛鈎列表:
有關不同掛鈎的更多信息,請參見githooks手冊頁 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.