Created
November 12, 2022 02:18
-
-
Save rafaelqueiroz88/b00197e556cbd54b00c4a9ce70ad4de6 to your computer and use it in GitHub Desktop.
Creating a Post-Checkout Hook
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 | |
# File checkout | |
if [ "$3" == "0" ]; then exit; fi | |
NUM_CHECKOUTS=`git reflog --date=local | grep -o ${BRANCH_NAME} | wc -l` | |
# If the refs of the previous and new heads are the same | |
# AND the number of checkouts equals one, a new branch has been created | |
if [ "$1" == "$2" ] && [ ${NUM_CHECKOUTS} -eq 1 ]; then | |
.github/run-rubocop.bash | |
.github/run-rspec.bash | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment