{"id":15779743,"url":"https://github.com/aldaviva/githooks","last_synced_at":"2025-04-14T20:45:09.911Z","repository":{"id":240014639,"uuid":"801367997","full_name":"Aldaviva/GitHooks","owner":"Aldaviva","description":"🎣 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.","archived":false,"fork":false,"pushed_at":"2025-04-07T15:17:00.000Z","size":146,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T14:20:03.484Z","etag":null,"topics":["fixme","git","git-hooks","package-lock","package-lock-json"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Aldaviva.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://paypal.me/aldaviva"]}},"created_at":"2024-05-16T05:15:37.000Z","updated_at":"2025-03-18T08:34:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"dd9a0814-69e5-4584-acfe-acd7233ea68c","html_url":"https://github.com/Aldaviva/GitHooks","commit_stats":null,"previous_names":["aldaviva/githooks"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aldaviva%2FGitHooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aldaviva%2FGitHooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aldaviva%2FGitHooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Aldaviva%2FGitHooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Aldaviva","download_url":"https://codeload.github.com/Aldaviva/GitHooks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248960436,"owners_count":21189984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fixme","git","git-hooks","package-lock","package-lock-json"],"created_at":"2024-10-04T18:21:19.380Z","updated_at":"2025-04-14T20:45:09.894Z","avatar_url":"https://github.com/Aldaviva.png","language":"C#","funding_links":["https://paypal.me/aldaviva"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"GitHooks/icon.ico\" height=\"24\" alt=\"logo\" /\u003e GitHooks\n===\n\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/Aldaviva/GitHooks/dotnet.yml?branch=master\u0026logo=github)](https://github.com/Aldaviva/GitHooks/actions/workflows/dotnet.yml)\n\nCustom logic that runs right before you create a Git commit.\n\n\u003c!-- MarkdownTOC autolink=\"true\" bracket=\"round\" autoanchor=\"false\" levels=\"1,2\" bullets=\"-,1.,-\" --\u003e\n\n- [Checks performed](#checks-performed)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n\n\u003c!-- /MarkdownTOC --\u003e\n\n## Checks performed\n- 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.\n    - 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.\n- Checks staged [.NET package lock files](https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#locking-dependencies) 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.\n    - 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.\n    - This dependency is preserved if the project publishes to a single file, for example if `PublishSingleFile` or `PublishAot` are set to `true` in the `.csproj` file.\n\n## Requirements\n- Operating system: Windows (x64 or arm64) or Linux (x64, arm, or arm64)\n- [Git](https://git-scm.com/downloads)\n- [.NET Runtime](https://dotnet.microsoft.com/en-us/download) 9 or later\n\n## Installation\n1. Download [`GitHooks.zip`](https://github.com/Aldaviva/GitHooks/releases/latest/download/GitHooks.zip) from the [latest release](https://github.com/Aldaviva/GitHooks/releases/latest).\n1. Locate the `pre-commit` executable in the subdirectory of the ZIP file which corresponds to your operating system and CPU architecture (e.g. `win-x64\\pre-commit.exe` for Windows x64).\n1. Extract that `pre-commit` executable to a Git hooks directory, depending on the scope you want it to apply to.\n    - **One repository:** extract it to `\u003crepo\u003e/git/hooks/pre-commit.exe`\n    - **All repositories for a user:** extract it to any directory, then run `git config --global core.hookspath \"\u003cdir\u003e\"`\n    - **All repositories for all users:** extract it to any directory, then run `git config --system core.hookspath \"\u003cdir\u003e\"`\n\n## Usage\nJust run `git commit` the way you normally would. If it commits successfully, there were no fatal errors.\n\nOtherwise, it will abort the commit and print a message showing why it stopped and how to proceed. This generally involves fixing whatever you commented with `FIXME`, removing that comment, running `git add` on that fixed file, and then calling `git commit` again with your original commit message.\n\n### Testing\nIf you want to run this hook without committing anything, you can call\n```sh\ngit hook run pre-commit --no-ignore-missing\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldaviva%2Fgithooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faldaviva%2Fgithooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faldaviva%2Fgithooks/lists"}