Guest User

Untitled

a guest
Feb 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. # Delete all local branches, except string/exact name
  2. # Tip: if an exact branch name to save is needed, append $
  3. git branch | grep -v "{BRANCH_NAME_TO_EXLCUDE}" | xargs git branch -D
  4.  
  5. # Delete all remote branches, except string/exact name
  6. 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;
  7.  
  8. # Sync with remote and prune all stale references
  9. git fetch -p
Add Comment
Please, Sign In to add comment