tl;dr Alias for removing local branches that are gone on remote # ~/.gitconfig file [alias] gone = "!f() { git fetch --all --prune; git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f" If your git workflow is using Pull Requests that are merged into main branch, after a while your local list of branches will get very messy, because most of the time the PR is merged and remote br
![🍂 Remove gone git branches](https://cdn-ak-scissors.b.st-hatena.com/image/square/7f45467369ccc62afc00d760978fba5d2fabdc0c/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fpracticaldev%2Fimage%2Ffetch%2Fs--9P2oJhVh--%2Fc_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_500%2Cq_auto%2Cw_1000%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwjils9gz76av0fsm6bm3.jpg)