This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This command does a git fetch, determines which branches on the remote have been removed, and clear them out of | |
| # your local repository. This is best performed when the `main` or `master` branch is currently checked out. | |
| # Place this file in /usr/local/bin (e.g. /usr/local/bin/git-pfetch) and mark as executable. Then simply use | |
| # it at the command line like you would any other git subcommand: `git pfetch`. Enjoy a cleaner workspace! | |
| git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done |