Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git delete all branches except master

git branch | grep -v "master" | xargs git branch -D
Comment

Git delete all branches except master

// -- Clear all branches except Master Branch --
git branch -D $(git branch | grep -v 'master')
// This will clear all your branches you have on local that you have 
// not pushed to your repository. eg: IF, you created a branch that was, 
// not pushed it will remain along with amster. 
// But the others will be cleaned.

// -- Delete a single branch
git branch -D branch-name
Comment

Remove all your local git branches but keep master

git branch | grep -v “master” | xargs git branch -D
Comment

delete all local branches except current branch

git branch | grep -v "master" | grep -v ^* | xargs git branch -D
Comment

git remove all branches except master windows

git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | %{ git branch -D $_ }
Comment

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

how to delete all branches in git except master

$ git branch | grep -v '^*' | xargs git branch -D
Comment

PREVIOUS NEXT
Code Example
Shell :: install deb package 
Shell :: git credentials 
Shell :: remove snap package 
Shell :: bash: /var/lib/snapd/snap/bin/docker-compose: No such file or directory 
Shell :: change message commit git 
Shell :: composer remove package 
Shell :: Failed to start Redis In-Memory Data Store. 
Shell :: ionic cordova live reload 
Shell :: unix delete file contents only 
Shell :: create remote git repository 
Shell :: ubuntu 20.04 uninstall imagemagick 
Shell :: vlc download for linux 
Shell :: git save username and password 
Shell :: download library to read text from a pdffile python 
Shell :: docker clear container logs 
Shell :: debian install opengl 
Shell :: Failed to load module "appmenu-gtk-module" 
Shell :: pip install airflow 
Shell :: git merge cancel 
Shell :: wslinux export 
Shell :: display id all image docker 
Shell :: how to save windows spotlight images 
Shell :: pipenv an error occurred while installing psycopg2==2.8.4 
Shell :: linux full permission to folder 
Shell :: git remote show origin 
Shell :: create tar 
Shell :: how to install minilibx in linux 
Shell :: how to install gnome user theme extension terminal 
Shell :: how to check yarn version 
Shell :: how to download a repository as zip 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =