简体   繁体   中英

Exclude commits from Git hooks?

Is it possible to exclude certain commits from being pushed to a service hook on Github? For example, if I only edit the Readme file of a project, it makes no sense to re-test the entire application on Travis. Is there a way I can tell Git that that particular commit should not be sent to the Travis hook?

There isn't a way to tell git push to skip hooks. You could, however, modify the hook to examine the received commit and only run the tests if a source file has been modified. How you do that depends on your project, but it could look for files with a certain extension, files in the src/ directory, etc.

To answer the Travis-related part: As explained in the Travis docs you can skip a build if you append [ci skip] to any of the commits you're going to push.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM