Created
June 15, 2023 22:57
-
-
Save mser-om/63ff8b638e8c1f09824eadc335d3bbb5 to your computer and use it in GitHub Desktop.
Git Pfetch command
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment