sbt-git-hooks is an sbt plugin for maintaining git hooks as part of your code.
Git hooks originally reside in .git/hooks
which is not versioned as part of the code, but it is something you
want to share with other contributors to your code. This plugin syncs git hooks from your project folder with the ones
in the .git/hooks
folder.
Sample files are ignored.
In order to add the sbt-git-hooks plugin to your build, add the following line to project/plugins.sbt
:
addSbtPlugin("za.co.absa.sbt" % "sbt-git-hooks" % "X.Y.Z")
Then, optionally, in your build.sbt
configure the following settings:
overwriteGitHookFiles := true
gitHookFilesLocation := "project/git_hooks"
overwriteGitHookFiles
setting allows you to overwrite the files already present in.git/hooks
. Defaults tofalse
gitHookFilesLocation
setting allows you to set a different folder for source of hook files. This is relative to the project. Defaults toproject/git_hooks
To run a sync use sbt syncGitHooks
.
To check which files would get synced and what would happen run sbt getGitHooksToSync
- Java 8 or higher
- sbt 1.3.0 or higher
Please see this file for more details.