/git-hooks

git hooks

Primary LanguageShell

Git hooks and tools to validate development specifications such as:

  1. Semantic version
  2. Conventional commit
  3. Vincent Driessen's branching model
  4. Languanges specification such as python, go...

Get Started

  1. Download git hooks to init.templateDir

    git config --global init.templateDir $HOME/.git-template
    git clone https://github.com/tzaiyang/git-hooks $HOME/.git-template
    # Check enviorment and dependencies
    bash $HOME/.git-template/hooks/scripts/check-dep.sh

    Activate git hooks in your repo:

    # copy init.templateDir to .git/hooks
    # you can customize your config to modify in .git/hooks/configs directory
    git init
    
    # deactivate
    rm -rf .git/hooks
  2. Manage branchs according Vincent Driessen's branching model with gitflow-avh tool.

    # Initialize a new git repo with support for the branching model.
    git flow init
    # start a new feature branch
    git flow feature start <name> [<base>]
  3. Git commit, the commit message should be structured as follows, More detail in conventional commit:

    <type>[optional scope]: <description>
    
    [optional body]
    
    [optional footer(s)]
    
  4. Release with semantic version spec tag according conventional commit specification:

    standard-version

References

  1. https://www.conventionalcommits.org/
  2. https://semver.org/