-
-
Save kholschevnikov/5a001aff6dfeda9b0cd3 to your computer and use it in GitHub Desktop.
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/sh | |
date=$1 | |
DRY_RUN=1 | |
if [ -z $1 ]; then | |
echo "Empty date" | |
exit; | |
fi | |
for branch in $(git branch -a --merged r_1.8.4 | sed /\*/d | grep -v '/master' | grep -v '/develop' | grep -v 'r_1.'); do | |
if [ ! -n "$(git log -1 --since=$1 -s $branch)" ]; then | |
if [[ "$branch" =~ "origin/" ]]; then | |
local_branch_name=$(echo "$branch" | sed 's/^origin\///') | |
if [[ "$DRY_RUN" -eq 1 ]]; then | |
echo "git push origin :$local_branch_name" | |
else | |
git push origin :$local_branch_name | |
fi | |
else | |
if [[ "$DRY_RUN" -eq 1 ]]; then | |
echo "git branch -D $branch" | |
else | |
git branch -D $branch | |
fi | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment