Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bypass commit hook

Janos Kukoda January 10, 2013

What does it mean, and when is it worth to use "Bypass commit hook" option?

1 answer

1 accepted

0 votes
Answer accepted
Rahul Aich [Nagra]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 11, 2013

Like many other Version Control Systems, Git has a way to fire off custom scripts when certain important actions occur. There are two groups of these hooks: client side and server side. The client-side hooks are for client operations such as committing and merging. The server-side hooks are for Git server operations such as receiving pushed commits.

The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code. Exiting non-zero from this hook aborts the commit, although you can bypass it with git commit --no-verify. You can do things like check for code style (run lint or something equivalent), check for trailing whitespace (the default hook does exactly that), or check for appropriate documentation on new methods.

The bypass commit hook option uses the --no-verify Git flag and by selecting this option you can bypass pre-commit hook.

A few link for you to learn more about hooks

http://linux.die.net/man/5/githooks

https://jira.atlassian.com/browse/SRCTREE-1011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

http://git-scm.com/book/en/Customizing-Git-Git-Hooks

Rahul

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events