Skip to content

How to avoid empty commit? #87

@SunilDSK

Description

@SunilDSK

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 have appsettings.Development.json as only file, the pre-commit is unstaging the appsettings.Development.json file, but it is also creating an empty commit with no files. How do I avoid the empty commit?

Steps to reproduce

  • Step 1: Once dotnet husky is installed, run the command - $ dotnet husky add pre-commit -c "git reset appsettings.Development.json".
  • Step 2: Then modify the file appsettings.Development.json.
  • Step 3: Then stage the file and try to commit it
  • Step 4: The git will unstage the appsettings.Development.json file and create an empty commit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions