Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacobmgevans/git-graft
NPX CLI tool that generates a configurable Git Hook that prepends branch name patterns to commit messages.
https://github.com/jacobmgevans/git-graft
commit commit-message git git-graft git-hook
Last synced: 2 months ago
JSON representation
NPX CLI tool that generates a configurable Git Hook that prepends branch name patterns to commit messages.
- Host: GitHub
- URL: https://github.com/jacobmgevans/git-graft
- Owner: JacobMGEvans
- License: mit
- Created: 2021-05-07T00:28:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-05T03:52:15.000Z (over 2 years ago)
- Last Synced: 2024-09-15T20:59:46.330Z (3 months ago)
- Topics: commit, commit-message, git, git-graft, git-hook
- Language: TypeScript
- Homepage:
- Size: 368 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-graft
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/git-graft.svg)](https://npmjs.org/package/git-graft)
[![Downloads/week](https://img.shields.io/npm/dw/git-graft.svg)](https://npmjs.org/package/git-graft)
[![License](https://img.shields.io/npm/l/git-graft.svg)](https://github.com/JacobMGEvans/git-graft/blob/master/package.json)NPX CLI tool that generates a configurable Git Hook that prepends branch name patterns to commit messages.
**Features:**
- Generated Git Hook
- Zero Config Option -- Utilizing GitFlow**Best Practice Examples**
- [GitKraken](https://www.gitkraken.com/learn/git/git-flow)
- [GitHub](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy#github-flow-branch-strategy)- Configurable [git-graft.json](#configuration)
- Hook is a bin file running Node & no dependencies
- Validates the commit message and branch
- [Usage](#usage)
- [Commands](#commands)# Usage
```sh-session
$ npx git-graft (-v|--version|version)
git-graft/0.0.0 linux-x64 node-v14.16.1
$ npx git-graft --help
Main Usage
$npx git-graft [COMMAND]
...
```# Commands
## **Init**
`init` will generate the Git Hook with Zero-Config or a configuration file based on prompts.
**example:**
```sh
npx git-graft init
```The prompts will be used to construct the [configuration](#configuration) file and ask to modify permissions to allow for execution of the generated Git Hook. Without permission to execute the Git Hook cannot work.
## **Doctor**
Will run file, directory, and permissions check on Git Graft Hook.
**example:**
```sh-session
// automatically gets filepath
$ npx git-graft doctor// user gives filepath
$ npx git-graft doctor [FILEPATH] --force```
# Configuration File
The [init](#init) generates a `git-graft.json` if **Zero-Config** isn't chosen. The config has properties for a configurable Git Hook. Configuration the patterns to validate the branch and resulting prepended commit message with branch information.
**branchTypes:**
`RegExp List` _required_ -- Refers to GitFlow best practices. Git Graft Hook will wrap the list in `()` and the constructor includes the forward slash & escape `\/` [example](#regex-examples)
**branchPattern:**
`RegExp` _required_ -- Refers to the code/ticket and name of the branch following the branchType. [example](#regex-examples)
**ticketTypes:**
`string` _required_ -- Refers to the ticket code types, for example JIRA will use TICKETTYPE-{NUMBERS}. The Git Hook will use this config to construct a `RegExp` for the prepending to commit messages.
**regExFlag:**
`RegExp` _optional_ -- Flags to pass into RegEx constructors. Default: `gim`
**ticketOnly:**
`boolean` _optional_ -- Used to determine if ticket/code or whole branch should used. Default: `true`
---
### RegEx Examples:
#### Zero Config RegExp Usage - https://regex101.com/r/UKwIK2/1
#### branchPattern - https://regex101.com/r/ewym8B/1
#### branchTypes - https://regex101.com/r/KNZio4/1