Some git hooks scripts that can be useful
Created
November 20, 2020 23:53
-
-
Save abaqueiro/f4f6060d5cdbfa2a334a015e9a38075b to your computer and use it in GitHub Desktop.
Git Hooks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG=hook-post-commit.log | |
echo Commit was made $(date '+%Y-%m-%d %H:%M:%S') >> $LOG | |
echo -n "Detecting current branch: " | |
BRANCH_NAME=$(git symbolic-ref --short HEAD) | |
if [ $? -eq 0 ]; then | |
echo "$BRANCH_NAME" | |
echo git push origin "$BRANCH_NAME" | |
git push origin "$BRANCH_NAME" | |
if [ $? -eq 0 ]; then | |
echo "[ OK ]" | |
fi | |
else | |
echo "ERROR, unable to detect current branch, detected: [$BRANCH_NAME]" | |
fi | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment