Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable hooks for a single git command

Given that I need to use git inside my hook scripts, I would prefer my hook scripts to not trigger hooks themselves. So I want to skip hooks on a per-command basis.

i.e. I am looking for an option like:

git --no-hooks some-git-command

like image 406
Gabriel Devillers Avatar asked Oct 11 '19 09:10

Gabriel Devillers


Video Answer


2 Answers

You can use:

git -c core.hooksPath=/dev/null some-git-command

If you are not on an Unix (no /dev/null) I suppose that you can use:

git -c core.hooksPath= some-git-command

like image 79
Gabriel Devillers Avatar answered Sep 28 '22 11:09

Gabriel Devillers


Another rougher idea.

  1. Just comment lines in file .git/hooks/pre-commit with symbol '#'.
  2. Run single or many commands
  3. Uncomment
  4. Profit.
like image 20
Ruslan Mavlyanov Avatar answered Sep 28 '22 10:09

Ruslan Mavlyanov