Skip to content

Instantly share code, notes, and snippets.

@khi-ai
Created October 13, 2024 10:40
Show Gist options
  • Save khi-ai/9a9db0356c9c284c7b44e4e5cb5ad86f to your computer and use it in GitHub Desktop.
Save khi-ai/9a9db0356c9c284c7b44e4e5cb5ad86f to your computer and use it in GitHub Desktop.
Delete all local git branches on powershell
git branch --list | ForEach-Object {
$branch = $_.Trim() # Loại bỏ khoảng trắng thừa
if ($branch -notmatch 'master|main') { # Tránh xóa nhánh chính
git branch -D $branch
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment