Created
February 28, 2022 15:45
-
-
Save dhbradshaw/d1c51f251c6e5ed1ff3ecd07c7676a17 to your computer and use it in GitHub Desktop.
Revisions
-
dhbradshaw created this gist
Feb 28, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Delete all redundant git branches # 1. `git branch` lists all the branches # 2. `xargs -L1` consumes the pipe output one line at a time, feeding it as an an arg to the target command # 3. `git branch -d` deletes the branches that are redundant (already merged). # Note: this print results for each branch, either # saying it's deleted or that you need to use -D to delete it because it's not redundant. git branch | xargs -L1 git branch -d