Skip to content
Discussion options

You must be logged in to vote

Based on this answer, the git check that you should not make an empty commit, runs before the pre-commit hook. I want the check to apply after my other pre-commit hook has run.

I managed to achieve something very similar using an extra task in the Husky.Net task runner:

{
  "$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
  "tasks": [
    {
      "name": "Format using CSharpier",
      "group": "pre-commit",
      "command": "dotnet",
      "args": ["csharpier", "${staged}"],
      "include": ["**/*.cs"]
    },
    {
      "name": "Check for empty commit",
      "group": "pre-commit",
      "command": "sh",
      "args": ["-c", "! git diff --cached --quiet"]
    }
  ]
}

Th…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ghostbird
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant