https://github.com/fredericrous/git-templates
opinionated git templates with its collection of hooks
https://github.com/fredericrous/git-templates
cicd command-line devops git hooks shell terminal
Last synced: 2 months ago
JSON representation
opinionated git templates with its collection of hooks
- Host: GitHub
- URL: https://github.com/fredericrous/git-templates
- Owner: fredericrous
- License: other
- Created: 2021-07-08T11:10:33.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T14:39:44.000Z (over 2 years ago)
- Last Synced: 2025-03-29T15:47:32.023Z (about 1 year ago)
- Topics: cicd, command-line, devops, git, hooks, shell, terminal
- Language: Shell
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Git Templates with hooks
Git Starter Template with opinionated hooks to help you create beautiful commits with high quality standards..and emojis ✨

*If there is an issue with a hook, please open an issue and consult the section [Opt Out](https://github.com/fredericrous/git-templates/wiki/Opt-Out) for a workaround.*
## The workflow
First, `commit`. A nice template [message](https://github.com/fredericrous/git-templates/blob/main/message) appears to help you write a meaningful commit description that passes the requirements.
The message saved, [validators](https://github.com/fredericrous/git-templates/wiki/Hooks-implemented) run in parallel. If there is an issue, the commit is aborted
Ready to push? once `git push` is started, the tests runs for the module you updated, branch name is checked. The branch is pushed. Bravo
The wiki explore in details [this workflow](https://github.com/fredericrous/git-templates/wiki/Coding-Flow)
The wiki also lists all the [implemented hooks](https://github.com/fredericrous/git-templates/wiki/Hooks-implemented)
## Setup
Clone the repository to a convenient place:
```sh
mkdir ~/.config/git
cd ~/.config/git
git clone https://github.com/fredericrous/git-templates.git
chmod +x templates/hooks/*
```
Setup your gitconfig
```sh
git config --global init.templatedir ~/.config/git/git-templates/templates
git config --global commit.template ~/.config/git/git-templates/message
```
Copy the hooks to existing repositories
```sh
cd
git init
```
## Update
Update the local clone to the latest version
```sh
cd ~/.config/git/git-templates/templates
git pull
```
Update the target repository
```sh
rm $(git rev-parse --git-dir)/hooks/*
git init
```
## Requirements
- Git 2.22+
- ZSH
- NodeJS 11.7+
- [ripgrep](https://github.com/BurntSushi/ripgrep/)
## Wiki
- [Coding Flow](https://github.com/fredericrous/git-templates/wiki/Coding-Flow) - an explanation of where the hooks fit in your git "flow"
- [Commit Prefix](https://github.com/fredericrous/git-templates/wiki/Commit-Prefix) - list of prefix your commit summaries should contain
- [Hooks Implemented](https://github.com/fredericrous/git-templates/wiki/Hooks-implemented) - all the hooks that are triggered when you execute a git command
- [Ideas of hooks to implement](https://github.com/fredericrous/git-templates/wiki/Ideas-of-hooks-to-implement) - a list of ideas, not a roadmap
- [Opt Out](https://github.com/fredericrous/git-templates/wiki/Opt-Out) - bypass a check, a hook or uninstall it
- [Similar Projects](https://github.com/fredericrous/git-templates/wiki/Similar-projects)
## Contribute
Basically if a script is simple implement it in shell script. If the logic is complicated, use javascript or any proper language to implement it. Javascript is nice because nowadays a lot of devs have nodejs installed on their machine.
There's a makefile, open it, see the different tasks, basically:
- `make test` runs the tests
- `make` is an alias to `make test`
- `make install` copies the hooks from this repo to both .git/ and ~/.config/git/
To run only one test, use `make test RUN=`