Last active
August 2, 2019 06:04
-
-
Save baflo/d22e9de7be3e6d52e2ae27e42dea0d21 to your computer and use it in GitHub Desktop.
Some git
This file contains 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
# Git hook to prevent focused tests/specs (fdescribe, fit) | |
red='\033[0;31m' | |
no_color='\033[0m' | |
focused_spec_findings=$(git grep --cached -nIE "^\s*f(describe|it)\b") | |
if [ ! -z "$focused_spec_findings" ] | |
then | |
# Redirect output to stderr. | |
exec 1>&2 | |
echo ${red}You still got some focused tests \(fdescribe, fit, etc.\), please clean these before committing:${no_color} | |
echo | |
echo Files: | |
echo "$(echo "$focused_spec_findings" | sed 's/^/# /')" | |
echo | |
exit 1 | |
fi |
This file contains 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
# Adds git alias `delete-merged-branches`, which suggests a list of branches that are already merged and should be deleted, then deletes them. | |
# `vipe` requires the `moreutils` package | |
git config alias.delete-merged-branches '!git branch --merged | grep -vE "(^\s*(master|develop)\s*$|^\*)" | EDITOR=nano vipe | xargs git branch -d' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment