1

I'm working on multiple repositories and one has some commit policies forced by client side hooks.
When I work in this repo and switch to the devel branch, it takes some time for the "hook preparations".

Can I somehow switch the current branch and forcefully ignore the hook stuff?
I know the option --no-verify for commit, but it is not working on checkout.

Environment: Windows, but this should be irrelevant

I tried the following:

git.exe checkout --no-verify develop -- 
-> 
error: unknown option `no-verify'
usage: git checkout [<options>] <branch>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Does this answer your question? [Git: checkout without running post-checkout hook](https://stackoverflow.com/questions/35447092/git-checkout-without-running-post-checkout-hook) – anthony sottile Nov 10 '22 at 13:59

1 Answers1

0

An alternative would be to use git worktree (detailed here) in order to have two different folders:

  • one for your repository develop branch
  • one for your repository normal working branch (a topic branch)

That way, you can switch from one branch to another without triggering any hook.

That being said, since git checkout is a local operation, check your <repo>/.git/hooks/post-checkout file, and why that script takes so much time.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • this does **not works out for me**: we are working on short-living branches (3..5 days) and so I'd have the same issue on the working branch – user3917391 Nov 11 '22 at 07:46
  • @user3917391 OK. Do you have an active `/.git/hooks/post-checkout` in your local repo (where you do your checkouts)? – VonC Nov 11 '22 at 09:10