Collection of Git hooks for automation
-
Bash version ~4 or greater
-
Git version ~2 or greater
-
Awk (GNU) version ~4 or greater
-
For pre-push and post-push hooks the
git-utilities/push-with-hooks
project, or similar script, should be installed -
For post-push hooks the remote should have
git-shell-commands
, or similar scripts installed
Make a directory path for organizing repositories...
mkdir -vp ~/git/hub/git-utilities
Change current working directory...
cd ~/git/hub/git-utilities
Clone with Git...
git clone --recurse-submodules [email protected]/git-utilities/hooks.git
Install the git-link-hook
script by symbolically linking to a directory listed within the PATH
variable for the currently logged-in user's, eg...
ln -s "${PWD}/git-link-hook" "${HOME}/bin/git-link-hook"
To update/upgrade hooks in the future utilize git pull
git submodule update
...
cd ~/git/hub/git-utilities/hooks
git pull origin master
git submodule update --init --merge --recursive
Every script within this repository is organized with the following syntax <hooks-target>/<command-target>
.
For example to activate jekyll-build
script for post-push
target, change directories to selected repository...
cd ~/git/hub/__org__/__repo__
Then run git-link-hook
script with the hook --name
and --target
parameters...
git link-hook --name jekyll-build --target post-push
Provided that the git-pust-wh
script is available, the following command should run the linked post-push
script...
git push-wh srv gh-pages
Note, usage tips may be output for any script by assigning HELP
as an environment variable prefix, eg...
cd ~/git/hub/git-utilities/hooks
HELP=true ./post-push/jekyll-build
This repository is not be feature complete and may not be fully functional, Pull Requests that add features or fix bugs are certainly welcomed.
Documentation for collection of Git hooks for automation
Copyright (C) 2020 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For further details review full length version of AGPL-3.0 License.