Skip to content

Instantly share code, notes, and snippets.

@kanikash4
Last active January 31, 2018 12:06
Show Gist options
  • Save kanikash4/643c447e85eae71e28e85b6b08bc6f77 to your computer and use it in GitHub Desktop.
Save kanikash4/643c447e85eae71e28e85b6b08bc6f77 to your computer and use it in GitHub Desktop.
Delete open but merged branches from production environment
# Delete a single open branch but merged branch from production environment
git push origin :remotes/origin/<branch_name>
#Delete all open but merged branches from production environment
for i in `git branch -r --merged production | grep -v "production" | awk -F / '{print $2}'`; do git push origin :$i; done
# check remaining branches count
git branch -a | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment