Created
October 13, 2024 10:40
-
-
Save khi-ai/9a9db0356c9c284c7b44e4e5cb5ad86f to your computer and use it in GitHub Desktop.
Delete all local git branches on powershell
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 characters
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