I have a server side hook (post-update) that will run after every code push I do. Is there any way (or maybe another hook?) to run it even if there are no new changes to push?
Example:
$ git push origin master
remote: Hook running....
$
$ git push origin master
Everything up-to-date
$
I'd like it to be run again. Is that possible?
Create a pre-receive hook, make it exit 1, and from the client git push origin master HEAD:non-existing-branch. This will trigger the pre-receive hook, even if there are no changes to master.
To avoid error messages, make the pre-receive hook exit successfully (exit 0), and manually remove the the non-existing-branch from the post-receive hook. However, this creates a small time window (when the file non-existing-branch exists) with the git push ... initiated from another client won't run the hooks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With