Current location - Education and Training Encyclopedia - Education and training - Solve the problem of prompting to automatically insert the change-id installation hook
Solve the problem of prompting to automatically insert the change-id installation hook
This hook is triggered by git commit and can be skipped by-no-verify. It has one parameter, which contains the path to the submission message file. If you exit in a non-zero state, the git submission will be cancelled. This hook can be used to modify the message file to match the standard format of the project (if any). It can also be used to validate submitted messages and reject submissions if necessary. The default commit-msg hook will check for duplicate signature lines when it is enabled, and if it is found, it will cancel the submission.

When git add“file "is added to the register and then git commit is performed to the local library, git needs to write a unique SHA- 1 value in the log when committing, that is, the value of Change-Id. Git commit will call the commit_msg script to check the submitted information, so that it can be pushed to the remote library normally when git push. Call the commit_msg hook script in the default directory, and the default directory is ". git/hooks/commit_msg "。 If there is no commit_msg script in this directory, there is no ChangeId information in the submission log, and there is an error when git push is pushed, so the changes cannot be uploaded to the remote server normally.

The following is an example of an error message when the git push submission is unsuccessful:

Copy the commit-msg script from the server to. git/hooks/

Reference article: gitlearning-analysis of missing Change-Id caused by-commit-msg deletion