This is my attempt to put together a bash routine to clean up my remote and local git branches.
It should:
origin/master
For anyone feeling confident that this script works for them, I've also included commands to delete the branches locally and on the remote repository commented out.
Your mileage may vary... use with extreme care!
for k in $(
git branch --remote --merged origin/master | fgrep origin | grep -v -E -- 'develop|stage|master' | sed /\*/d
); do
if (($(git log -1 --since='4 weeks ago' -s $k|wc -l)==0)); then
# Use bash to replace 'origin/' with '' and assign to $branch
branch=${k/origin\//}
echo $branch
# git push origin --delete $branch
# git branch -d $branch
fi
done