proof of concept
manage git expectations
Manual for now.
cd $GOPATH/src
git clone https://github.com/0xcastleblack/git-smart.git
cd git-smart
go install
This assumes this repo was cloned into $GOPATH/src/git-smart
.
Run the following commands to create the hooks in your repo.
ln -sf $GOPATH/src/git-smart/git-smart-wrapper .git/hooks/commit-msg
ln -sf $GOPATH/src/git-smart/git-smart-wrapper .git/hooks/pre-commit
ln -sf $GOPATH/src/git-smart/git-smart-wrapper .git/hooks/prepare-commit-msg
ln -sf $GOPATH/src/git-smart/git-smart-wrapper .git/hooks/pre-push
---
commitMessage: # commit-msg hook
commit: # `commit` type
enabled: `boolean` # enabled?
verificationRegEx: `string` # regular expression used to validate the user defined message
prepareCommitMessage: # prepare-commit-msg hook
commit: # `commit` type
enabled: `boolean` # enabled?
template: `string` # template for the git message (used when using the `git commit` command
prePush: # pre-push hook
enabled: `boolean` # enabled?
enforceProtectedBranchesOnNonExistentRemote: `boolean` # do we want to enforce the `protectedBranches` logic for remote branches that do *not* exist?
protectedBranches: `string[]` # branches that are protected -- you cannot push to them directly
validBranches: `string[]` # validate branch names
preCommit: # pre-commit hook
enabled: `boolean` # enabled?
execute: # commands and optional arguments to run
- command: `string` # first command to run
arguments: `string[]` # first commands (optional) arguments
- command: `string` # second command to run
arguments: `string[]` # ... etc
- command: `string` # no limit to the number of commands
arguments: `string[]`
This will exist in your source code repository.
---
commitMessage:
commit:
enabled: true
verificationRegEx: >
\A(build|ci|docs|feat|fix|perf|refactor|test)(\(([^\(\)]+)\))?: ([^\n]*)\n\n([^\n]*)((\n)?(\n)?([^\n]*))(\n)?
prepareCommitMessage:
commit:
enabled: true
template: >
<type>(<scope>): <title>
<message>
prePush:
enabled: true
protectedBranches: [
"master",
"^release/v[0-9]+(.[0-9]+)*$"
]
validBranches: [
"^feature/.*$"
]
preCommit:
enabled: true
execute:
- command: "echo"
arguments: ["1", "Hello", "world!"]
- command: "echo"
arguments: ["2 Hello world!"]
- command: "black"
git config --local commit.gpgSign true
git config --local tag.gpgSign true
git config --local commit.template a-file-containing-template-from-yaml