Skip to content

git-utilities/push-with-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Push With Hooks

Bash script calls pre-push and/or post-push Git hooks

Byte size of Push With Hooks Open Issues Open Pull Requests Latest commits



Requirements

This repository makes use of Git Submodules for tracking dependencies, to avoid incomplete downloads clone with the --recurse-submodules option...

git clone --recurse-submodules [email protected]:git-utilities/push-with-hooks.git

To update tracked Git Submodules issue the following commands...

git pull

git submodule update --init --merge --recursive

To force upgrade of Git Submodules...

git submodule update --init --merge --recursive --remote

Note, forcing and update of Git Submodule tracked dependencies may cause instabilities and/or merge conflicts; if however everything operates as expected after an update please consider submitting a Pull Request.


Quick Start

Symbolically link the git-push-wh script to a directory accessible within currently logged-in user's PATH, eg...

cd ~/git/hub/git-utilities/push-with-hooks

ln -s "${PWD}/git-push-wh" "${HOME}/bin/git-push-wh"

Usage

Changed directories to a Git repository that has pre-push and/or post-push Git hooks scripts...

cd ~/git/hub/__org__/__repo__

Run git push-wh <parameters...> instead of git push <parameters...>, eg...

git push-wh srv gh-pages

If pre-push or post-push script(s) are detected (and executable) within the .git/hooks or hooks directory, then either or both will be called with push arguments.


Notes

This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.

  • if pre-push returns an error then the git-push-wh script will exit before running git push or post-push

  • if git push returns an error then the git-push-wh script will exit before running post-push

To test the git-push-wh script, try adding the following scripts to a repository...

.git/hooks/pre-push

#!/usr/bin/env bash

printf 'pre-push script called with -> %s\n' "${*}"

.git/hooks/post-push

#!/usr/bin/env bash

printf 'post-push script called with -> %s\n' "${*}"

... then provide executable permissions to each...

chmod u+x .git/hooks/pre-push
chmod u+x .git/hooks/post-push

... then run git push-wh with or without any additional Git arguments.


Attribution


License

Bash script calls pre-push and/or post-push Git hooks
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.

About

Bash script calls pre-push and/or post-push Git hooks

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages