Skip to content
Versora

Manual

Branches and remotes

Skip hooks on push, pull, merge and rebase

4 min read

On this page

Hooks are repository scripts git runs at certain moments: before the push (pre-push), before the rebase (pre-rebase), before writing a merge's commit (pre-merge-commit, commit-msg). Teams use them to run tests or check messages. Sometimes a broken or slow hook blocks an urgent push: Versora lets you skip the hooks, just that once.

To skip the commit hooks (pre-commit and commit-msg in the commit box), use Commit options › Skip Git hooks (see Commits).

Where to find it

  • The repository bar: the Push arrow (Push options) › Push without hooks.
  • The repository bar: the Pull arrow (Pull options) › the pull in the default mode "without hooks", for example Pull (rebase) without hooks.
  • Palette (Ctrl+P): "Push without hooks" and "Pull without hooks".
  • When a hook refuses a push, a pull or a rebase, the error notice comes with Try without hooks.
  • When a hook refuses a merge's commit, the notice comes with Finish the merge without hooks.
  • In the local squash merge, the Skip hooks on the commit (--no-verify) checkbox (see Merge and rebase).

Step by step: when the hook refuses

  1. Click Push. The pre-push hook fails (for example, a broken test).
  2. The notice shows git's output and "The pre-push hook refused the operation."
  3. Check the output. If it's safe to go ahead, click Try without hooks.
  4. The bar shows "Pushing without hooks…" and, at the end, "Pushed feature/login without hooks".

Versora only offers the button when it can confirm it was a hook: from git's message and from the hooks that exist in the repository (honoring core.hooksPath). Refusals from the server, the network or a conflict don't get the button.

A merge stopped by a hook

When a hook refuses a merge's commit (in a regular merge or in a pull by merge), git leaves the merge in progress, with everything staged. The notice says: "The pre-merge-commit hook refused the merge commit. The merge is still in progress, with everything staged." The Finish the merge without hooks button writes the merge commit without redoing anything. At the end, "Merge finished without hooks" shows up.

What Versora does in git

bash
# Push without hooks
git push --no-verify
# if the pre-push hook is Git LFS's, the LFS files are uploaded first:
git lfs push origin feature/login
git push --no-verify

# Pull without hooks
git pull --no-rebase --ff --no-edit --no-verify     # merge modes
git fetch origin && git rebase --no-verify         # rebase mode (see below)

# Rebase without hooks (Try without hooks after a pre-rebase)
git rebase --no-verify main

# Finish the merge without hooks
git commit --no-edit --no-verify

git pull --rebase --no-verify doesn't pass the option on to the rebase (pre-rebase would run anyway). That's why, in rebase mode, Versora does the two steps the pull would do: a fetch from the upstream's remote and rebase --no-verify onto the upstream.

In a force push without hooks, the protection stays: --force-with-lease and --force-if-includes go along with --no-verify.

How to undo

  • Pull, rebase and a finished merge: Ctrl+Z undoes them as in the regular operation.
  • Finish the merge without hooks: Ctrl+Z undoes the whole merge, not just the commit: the branch and the files go back to the commit before the merge (git reset --hard). If the merge was started in Versora, the undo button shows the name of the operation that started it (for example "Undo: Merge feature/login" or "Undo: Pull"); if it came from the terminal, "Undo: Merge finished without hooks".
  • Push: Ctrl+Z doesn't undo a push.

Caveats and messages

  • "The pre-push hook refused the operation. To go ahead without it, use Push without hooks or Pull without hooks (toolbar menus) or the command palette.": the hook refused in an operation that can't be repeated from the notice itself.
  • "Pushing without hooks needs to upload the Git LFS files first, and the upload failed: …": Versora tried to upload the LFS objects (which the hook would skip) and couldn't. Check the network and the LFS authentication.
  • "There's no merge in progress to finish.": the merge has already been finished or aborted.
  • "The merge still has conflicted files: resolve them before finishing.": resolve the conflicts before using Finish the merge without hooks.

Caution

Skipping hooks lets through exactly what the team wanted to block. Only do it when you know why the hook failed, and let the team know if needed.

  • There's no preference to always skip hooks: the choice applies only to the operation in which it was made.

See also