青柠部落阁青柠部落阁
Java
Git
Collect
Vue
Nginx
Others
GitHub
Java
Git
Collect
Vue
Nginx
Others
GitHub
  • Git

    • Windows清除除当前分支外的所有本地分支

Windows清除除当前分支外的所有本地分支

PowerShell

git branch | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" -and $_ -ne $null -and $_ -notmatch '^\*' } | ForEach-Object { git branch -D $_ }

命令行提示符

for /f "tokens=*" %i in ('git branch ^| findstr /v /c:"*"') do git branch -D %i

Git Bash

git branch | grep -v "$(git symbolic-ref --short HEAD)" | xargs git branch -D
Contributors: ChenYue