Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git prune local branches

# for pruning of local branches that have been deleted on remote
git remote prune origin

# for checking local branches and if they can be deleted
# because they have been merged into another branch already
git branch --merged >/tmp/merged-branches && 
  vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
Comment

git prune local branches

# To delete local old/merged branches:
git fetch --prune
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d

# This string gets the list of remote branches and passes it into egrep through the standard input. And filters the branches that have a remote tracking branch (using git branch -vv and filtering for those that have origin) then getting the first column of that output which will be the branch name.
# Finally passing all the branch names into the delete branch command.
# Since it is using the -d option, it will not delete branches that have not been merged into the branch that you are on when you run this command.
# Also remember that you'll need to run git fetch --prune first, otherwise git branch -r will still see the remote branches.
Comment

git prune local branches

npx git-removed-branches --prune
Comment

PREVIOUS NEXT
Code Example
Shell :: python zlib 
Shell :: install gitlab-ce on centos 
Shell :: shell echo new line into file 
Shell :: download atom for ubuntu 18.04 
Shell :: .aws directory not found 
Shell :: api to access gitlab varaible 
Shell :: switch branches in git 
Shell :: decrypt user password linux 
Shell :: add ssh key to github 
Shell :: cert manager version 
Shell :: download file on linus ssh 
Shell :: git create branch and checkout one command 
Shell :: java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_VERSION_DOWNGRADE: Package Verification Result 
Shell :: npm install tough-cookie 
Shell :: powershell create new file and open 
Shell :: how to make .gitignore 
Shell :: install 
Shell :: Download file from URL on Linux using command line 
Shell :: basename bash 
Shell :: linux scroll terminal 
Shell :: scp from server to my computer 
Shell :: git stash bitbucket 
Shell :: ffmpeg denoise audio 
Shell :: quit nano 
Shell :: pip install datetime 
Shell :: How do I save terminal output to a file? 
Shell :: how to push repository to github 
Shell :: install virtualbox linux 
Shell :: create github repository from git bash 
Shell :: git create master branch in empty repository 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =