Skip to content

Instantly share code, notes, and snippets.

@Br3nda
Last active June 28, 2020 21:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Br3nda/c50b35ce01d83f17536264f67b61be25 to your computer and use it in GitHub Desktop.
Save Br3nda/c50b35ce01d83f17536264f67b61be25 to your computer and use it in GitHub Desktop.
#!/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