From fda73aa3d411120dadc57eac612ae78c6aa72bf9 Mon Sep 17 00:00:00 2001 From: zyimm Date: Fri, 27 Oct 2023 14:27:29 +0800 Subject: [PATCH] =?UTF-8?q?:art:git=20=E5=88=A0=E9=99=A4=E5=88=86=E6=94=AF?= =?UTF-8?q?=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _posts/Linux/linux-command.md | 6 +++--- _posts/git/batch_delete_branch.md | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/_posts/Linux/linux-command.md b/_posts/Linux/linux-command.md index 1fb5685..0d795a8 100644 --- a/_posts/Linux/linux-command.md +++ b/_posts/Linux/linux-command.md @@ -9,6 +9,7 @@ tags: Linux 地址❤️:[Linux Command建立这个镜像站点!http://linux.zyimm.com](http://linux.zyimm.com/) ## docker 安装 + ```shell # 拉取镜像 docker pull ghcr.io/jaywcjlove/linux-command:latest @@ -26,7 +27,6 @@ docker run --name linux-command --rm -d -p 3100:3000 wcjiang/linux-command:lates - [Markdown官方教程 https://markdown.com.cn](https://markdown.com.cn/intro.html) - [emoji表情参考 https://emojipedia.org](https://emojipedia.org/) - - ## 推荐 -其实我还推荐一个关于linux命令参考网站:[www.linuxcool.com(命令示例也不错!)](https://www.linuxcool.com/) \ No newline at end of file + +其实我还推荐一个关于linux命令参考网站:[www.linuxcool.com(命令示例也不错!)](https://www.linuxcool.com/) diff --git a/_posts/git/batch_delete_branch.md b/_posts/git/batch_delete_branch.md index 6e73b06..044ce53 100644 --- a/_posts/git/batch_delete_branch.md +++ b/_posts/git/batch_delete_branch.md @@ -45,3 +45,10 @@ git branch -r | grep -v "main" | sed 's/origin\//:/' | xargs git push ``` `main`为要保留的分支名称,可以根据需要进行修改。最后一个命令中的sed命令是将远程分支名中的`origin/`替换为`:/`,因为git push命令中需要使用的远程分支名不包含`origin/` + +### 5. 删除远程分支已经删除,但本地仍然存在的分支 + +```shell +git remote prune origin +``` +该命令会检查本地仓库中的远程分支引用,并将那些在远程仓库中已经不存在的分支引用删除掉,以保持本地仓库的分支列表与远程仓库保持同步。