Below is the script which I'm executing but unable to succeed. the task is delete branch date specific
ECHO='echo '
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
if [[ "$(git log $branch --since "20 Jun 2021" | wc -l)" -eq 0 ]]; then
if [[ "$DRY_RUN" = "false" ]]; then
ECHO=""
fi
local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///')
$ECHO git branch -d "${local_branch_name}"
$ECHO git push origin --delete "${local_branch_name}"
fi
done
Below is the script which I'm executing but unable to succeed. the task is delete branch date specific ECHO='echo ' for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do if [[ "$(git log $branch --since "20 Jun 2021" | wc -l)" -eq 0 ]]; then if [[ "$DRY_RUN" = "false" ]]; then ECHO="" fi local_branch_name=$(echo "$branch" | sed 's/remotes\/origin\///') $ECHO git branch -d "${local_branch_name}" $ECHO git push origin --delete "${local_branch_name}" fi done