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-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14808994.html
未经授权禁止转载,违者必究!