alirezanet / Husky.Net

Git hooks made easy with Husky.Net internal task runner! 🐶 It brings the dev-dependency concept to the .NET world!
https://alirezanet.github.io/Husky.Net/
MIT License
684 stars 31 forks source link

your current branch does not have any commits yet #27

Closed alirezanet closed 2 years ago

alirezanet commented 2 years ago

Version

0.4.0

Details

Should prevent git exception In a clean new repo, when there are no commits.

Steps to reproduce

{
   "tasks": [
      {
         "command": "dotnet",
         "group": "pre-commit",
         "args": [ "dotnet-format", "--include", "${staged}" ],
         "include": [ "**/*.cs", "**/*.vb" ]
      }
   ]
}

Temporary workaround

Adding an empty commit before Step 3 can solve the problem. git commit --allow-empty -m "first commit"

alirezanet commented 2 years ago

Fixed via PR #34, in v0.4.1