Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Delete all local branches, except string/exact name
- # Tip: if an exact branch name to save is needed, append $
- git branch | grep -v "{BRANCH_NAME_TO_EXLCUDE}" | xargs git branch -D
- # Delete all remote branches, except string/exact name
- git branch -r | grep {REMOTE_NAME]}/ | grep -v '{BRANCH_NAME_TO_EXLCUDE}' | grep -v HEAD| cut -c {REMOTE_NAME_LENGTH+3}- | while read line; do git push {REMOTE_NAME} :$line; done;
- # Sync with remote and prune all stale references
- git fetch -p
Add Comment
Please, Sign In to add comment