Skip to content

greeflas/git-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Useful scripts for Git Hooks

Build Status

prepare-commit-msg

  • ticket_number.sh - this script adds ticket number to commits in feature branch. It gets ticket number from branch name. Branch name should have following format EXAMPLE-305/some_feature.

    For example if first commit is named Implements some feature this script will update it with ticket number and it will look like EXAMPLE-305 Implements some feature.

    Also you can set EACH_COMMIT variable to false if you want add ticket number only for the first commit.

    Symlink: ln -s ~/tools/git-hooks/src/prepare-commit-msg/ticket_number.sh .git/hooks/prepare-commit-msg

pre-commit

  • php_cs_fixer.sh - this script runs PHP-CS-Fixer before commit for fixing code style.

    Symlink: ln -s ~/tools/git-hooks/src/pre-commit/php_cs_fixer.sh .git/hooks/pre-commit

  • phpunit.sh - this script runs PHPUnit before commit for running tests.

    Symlink: ln -s ~/tools/git-hooks/src/pre-commit/phpunit.sh .git/hooks/pre-commit

  • check_working_on_master.sh - this script helps to warn if you make commit on the master branch.

    Symlink: ln -s ~/tools/git-hooks/src/pre-commit/check_working_on_master.sh .git/hooks/pre-commit

post-merge

  • composer_install.sh - this script installs composer packages specified in composer.json or composer.lock (if it presents) file after git pull or git merge.

    Symlink: ln -s ~/tools/git-hooks/src/post-merge/composer_install.sh .git/hooks/post-merge

Installation

  1. Pull this repo to some place in your machine

    $ git clone https://github.com/greeflas/git-hooks.git

  2. Create a symlink for needed script in your project .git/hooks directory

    $ ln -s ~/tools/git-hooks/src/prepare-commit-msg/ticket_number.sh .git/hooks/prepare-commit-msg

Contributing

For information about contributing please read CONTRIBUTING.md.

License

license

This project is released under the terms of the BSD-3-Clause license.

Copyright (c) 2019 - 2024, Volodymyr Kupriienko

Releases

No releases published

Packages

No packages published

Languages