Delete all local git branches
The ‘git branch -d’ subcommand can delete more than one branch. So, simplifying @sblom’s answer but adding a critical xargs: or, further simplified to: Importantly, as noted by @adminndrewC, using git branch for scripting is discouraged. To avoid it use something like: Caution warranted on deletes!