xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

git prune All In One

git prune All In One

git 剪枝

prune / 修剪

$ git gc help

$ rm .git/gc.log
$ rm -rf .git/gc.log

# git prune

$ git remote prune origin --dry-run

$ git remote prune origin

demo

gp
warning: redirecting to https://git.xgqfrms.xyz/app/web.git/
remote: Enumerating objects: 209, done.
remote: Counting objects: 100% (170/170), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 73 (delta 52), reused 2 (delta 0), pack-reused 0
Unpacking objects: 100% (73/73), done.
From https://git.xgqfrms.xyz/app/web.git/
   dbde387a4..d854aaac9  dev                            -> origin/dev
   15f7a7240..8a538db27  release                        -> origin/release
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
warning: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.


solution

# 查看所有的分支,包括本地和远程的
$ git branch -a

# 查看有关于origin的一些信息,以及与本地仓库的关系,  包括分支是否tracking
$ git remote show origin


# 测试, 查看哪些分支会被清理
$ git remote prune origin --dry-run

# 清理无效远程分支, 刷新本地仓库与远程仓库的保持这些改动的同步
$ git remote prune origin

refs

在你经常使用的命令当中有一个 git branch –a 用来查看所有的分支,包括本地和远程的。

但是时间长了你会发现有些分支在远程其实早就被删除了,但是在你本地依然可以看见这些被删除的分支。

https://www.cnblogs.com/wangiqngpei557/p/6058115.html

https://www.cnblogs.com/wt645631686/p/13819236.html

https://segmentfault.com/a/1190000018833716



©xgqfrms 2012-2025

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(221)  评论(4编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-05-25 JavaScript palindrome string All In One
2020-05-25 软件外包
2020-05-25 函数签名
2020-05-25 Flask
2020-05-25 OpenGL
2018-05-25 HTML5 Web Component & Vanilla JavaScript All In One
2018-05-25 Unix & restart Apache & Apache Proxy
点击右上角即可分享
微信分享提示