From b1efc1fea8c05a99b36ac56458b075e67b929c0a Mon Sep 17 00:00:00 2001 From: zyimm Date: Tue, 12 Dec 2023 09:55:45 +0800 Subject: [PATCH] =?UTF-8?q?:art:=F0=9F=86=92Git=20=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=9C=AC=E5=9C=B0=E4=BB=A5=E5=8F=8A=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/git/batch_delete_branch.md | 1 + 1 file changed, 1 insertion(+) diff --git a/_posts/git/batch_delete_branch.md b/_posts/git/batch_delete_branch.md index e84a798..387ed6a 100644 --- a/_posts/git/batch_delete_branch.md +++ b/_posts/git/batch_delete_branch.md @@ -42,6 +42,7 @@ git branch | grep -v "main" | xargs git branch -D ```shell git branch -r | grep -v "main" | sed 's/origin\//:/' | xargs git push +# -v:反转匹配,只显示不匹配的行。 ``` `main`为要保留的分支名称,可以根据需要进行修改。最后一个命令中的sed命令是将远程分支名中的`origin/`替换为`:/`,因为git push命令中需要使用的远程分支名不包含`origin/`