With a one official repository as the remote, and multiple local repositories cloned from it, can a pre-commit hook be scripted on that main repository and be enforced on al
I create a new file: pre-commit-hook.sh
#!/usr/bin/env bash
CHANGES=$(git whatchanged ..origin)
if [ ! -z "${CHANGES}" ]; then
echo "There are changes in remote repository. Please pull from remote branch first."
exit 1;
fi
exit 0;
And this is how I commit to Git:
bash pre-commit-hook.sh && git commit -m ""