You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					23 lines
				
				802 B
			
		
		
			
		
	
	
					23 lines
				
				802 B
			|   
											10 years ago
										 | #!/usr/bin/env bash | ||
|  | # | ||
|  | # mfprune | ||
|  | # | ||
|  | # Prune all your merged branches and any branches whose remotes are gone | ||
|  | # Great way to clean up your branches after messing around a lot | ||
|  | # | ||
|  | 
 | ||
|  | echo "Pruning Merged Branches..." | ||
|  | git branch --merged | egrep -v "^\*|RC|RCBugFix|dev" | xargs -n 1 git branch -d | ||
|  | echo | ||
|  | 
 | ||
|  | echo "Pruning Remotely-deleted Branches..." | ||
|  | git branch -vv | egrep -v "^\*|RC|RCBugFix|dev" | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D | ||
|  | echo | ||
|  | 
 | ||
|  | echo "You may want to remove these remote tracking references..." | ||
|  | comm -23 \ | ||
|  |   <(git branch --all | sed 's/^[\* ] //' | grep origin/ | grep -v "\->" | awk '{ print $1; }' | sed 's/remotes\/origin\///') \ | ||
|  |   <(git branch --all | sed 's/^[\* ] //' | grep -v remotes/ | awk '{ print $1; }') \ | ||
|  |   | awk '{ print "git branch -d -r origin/" $1; }' | ||
|  | echo |