Skip to content

🎣 Before each Git commit, remove Microsoft.NET.ILLink.Tasks from package lock file to unbreak locked mode build machine jobs. Abort the commit if FIXME appears in any of the staged files.

License

Notifications You must be signed in to change notification settings

Aldaviva/GitHooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo GitHooks

GitHub Actions

Custom logic that runs right before you create a Git commit.

Checks performed

  • Checks for FIXME in any of the staged text files, so that you don't accidentally commit any code that you don't want to.
    • If it finds any, it stops the commit and tells you which file and line number it was found in, so you can fix the code.
  • Checks staged .NET package lock files for Microsoft.NET.ILLink.Tasks, which is automatically added by Visual Studio and causes package restoration in locked mode to fail because it's not a real dependency of your project.
    • If it finds any, it automatically removes this dependency from packages.lock.json so that dotnet restore --locked-mode will succeed. This does not break Visual Studio either, which will either ignore it or try to add it again later. The commit continues automatically.

Requirements

Installation

  1. Download pre-commit.exe from the latest release.
  2. Save it to a Git hooks directory, depending on the scope you want it to apply to.
    • One repository: <repo>/git/hooks/pre-commit.exe
    • All repositories for a user: any directory, then run git config --global core.hookspath "<directory>"
    • All repositories on a computer: any directory, then run git config --system core.hookspath "<directory>"

Usage

Just run git commit the way you normally would. If it commits successfully, there were no fatal errors.

Testing

If you want to test the hook without committing anything, you can run

git hook run pre-commit --no-ignore-missing

About

🎣 Before each Git commit, remove Microsoft.NET.ILLink.Tasks from package lock file to unbreak locked mode build machine jobs. Abort the commit if FIXME appears in any of the staged files.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Languages