Skip to content

Instantly share code, notes, and snippets.

@Br3nda

Br3nda/post-checkout.sh

Last active Jun 28, 2020
Embed
What would you like to do?
#!/usr/bin/env bash
LC_ALL=C
# Place this in .git/hooks/post-checkout
local_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ $local_branch == "master" ]]
then
echo "==============================================="
echo "There is something wrong with your branch name."
echo " We no longer use the master branch."
echo " *** Moving you to main branch instead ***"
echo "==============================================="
git checkout main
git branch -d master
exit 1
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment