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 :: mysql inline pass cli 
Shell :: WSL 2 requires an update to its kernel component. 
Shell :: how to fork litecoin 
Shell :: bash run inline command 
Shell :: linux shred command 
Shell :: how to deallocate a port 
Shell :: ubuntu exec how to exit 
Shell :: ufw add rule 
Shell :: aws cli ec2 list instances 
Shell :: libxml2 install 
Shell :: uninstall vscode from linux 
Shell :: compress file in terminal 
Shell :: git load certain commit 
Shell :: uninstall package from ubuntu 
Shell :: how to use multiple commands in linux 
Shell :: linux ls order by size 
Shell :: git status just shows directory and not files 
Shell :: how to find maven home in linux 
Shell :: linux pfx to pem 
Shell :: linux get date yyyymmdd 
Shell :: git shows folder but wont open 
Shell :: apt install only update 
Shell :: delete folder from github repository 
Shell :: bash print line if column value is in column of another file 
Shell :: crontab delay after reboot 
Shell :: docker clean logs 
Shell :: bash message partial match 
Shell :: sudo apt-get install podman 
Shell :: install paho mqtt client raspberry pi 
Shell :: nginx: invalid option: "restart" 
ADD CONTENT
Topic
Content
Source link
Name
9+3 =