Replies: 1 comment 4 replies
-
Hi @SunilDSK, if you wanna prevent commits if something like: #!/bin/sh
. "$(dirname "$0")/_/husky.sh"
dotnet husky run -v --group "pre-commit" task-runner.json {
"tasks": [
{
"name": "Verify staged files",
"group": "pre-commit",
"include": "appsettings.Development.json",
"command": "cmd",
"args": ["/c", "git reset appsettings.Development.json & exit 1", "${staged}"]
}
]
} This would automatically unstage the also using taks-runner makes your console log prettier :) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version
0.6.0
Details
I have a webapi project with environment specific appsettings.json file. I don't want the
appsettings.Development.json
to be committed or pushed(its already tracked). I have a pre-commit hook with one command -git reset appsettings.Development.json
. When I haveappsettings.Development.json
as only file, the pre-commit is unstaging theappsettings.Development.json
file, but it is also creating an empty commit with no files. How do I avoid the empty commit?Steps to reproduce
$ dotnet husky add pre-commit -c "git reset appsettings.Development.json"
.appsettings.Development.json
.appsettings.Development.json
file and create an empty commit.Beta Was this translation helpful? Give feedback.
All reactions