Cleanup old remote git branches
Cleanup old remote git branches
Section titled “Cleanup old remote git branches”# Fetch the remote resourcesgit fetch
# Loop through all remote merged branchesfor branch in $(git branch -r --merged | grep -v HEAD | grep -v develop | grep -v master | grep -v master | sed /\*/d); do if [ -z "$(git log -1 --since='Jun 15, 2020' -s ${branch})" ]; then echo -e `git show --format="%ci %cr %an" ${branch} | head -n 1` \\t$branch remote_branch=$(echo ${branch} | sed 's#origin/##' ) # To delete the branches uncomment the bellow git delete command #git push origin --delete ${remote_branch} fidone