Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git delete all remote branches except master

git branch -r | grep 'origin' | grep -v 'master$' | grep -v HEAD | cut -d/ -f2- | while read line; do git push origin :heads/$line; done;
Comment

Remove All Local Branches not on Remote

$ git branch -r | egrep -v -f /dev/fd/0  <(git branch -vv | grep origin) | xargs git branch -d
Comment

remove all local branches deleted on remote

# Shorthand for deleting localy all branches already deleted on remote
# set this alias in git.config
git config --global alias.gone "! git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == "[gone]" {print $1}' | xargs -r git branch -D"
# then run
git gone
Comment

PREVIOUS NEXT
Code Example
Shell :: git look at changes to a file 
Shell :: where is www folder ubuntu 
Shell :: how to combine audio tracks ffmpeg 
Shell :: run docker compose 
Shell :: install netbeans in ubuntu 20.04 
Shell :: how to create a file with a given size in linux? 
Shell :: change file permissions terminal 
Shell :: nohup redirect output 
Shell :: git clone in 
Shell :: prometheus reload 
Shell :: tailwind vite 
Shell :: ssh to k8s pod 
Shell :: docker-compose build 
Shell :: git how to update branch from master 
Shell :: random color npm 
Shell :: python pytorch 
Shell :: linux shuton after time 
Shell :: QSslSocket: cannot resolve CRYPTO_set_id_callback QSslSocket: cannot resolve CRYPTO_set_locking_callback QSslSocket: cannot resolve sk_free QSslSocket 
Shell :: how to add a gif to a readme 
Shell :: how to set meld as git difftool 
Shell :: how to install cuda on ubuntu 
Shell :: git commit and add in one command 
Shell :: ntfsfix ubantu 
Shell :: git reflog reset 
Shell :: how to update to latest version of chrome in ubuntu 17.04 
Shell :: adobe reader linux 
Shell :: install django debian 
Shell :: how to install nvm in ubuntu 
Shell :: ubuntu wifi enabled no internet connection 
Shell :: install maven dependencies 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =