git相关问题记录

文章讲述了在工作中遇到的Git问题,如提交后报错不影响提交但提示有过多悬空对象,提供了解决方案(gitgc--prune)和批量删除本地分支的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

git问题:

工作中遇到的git问题记录📝

问题1:

git push提交代码之后报错 但是不影响提交后果

error: The last gc run reported the following. Please correct the root cause
and remove 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.
————————————————

解决方案:

直接运行git gc --prune=now把所有的悬空对象都清空

批量删除分支:

git branch | grep '文件名匹配' | xargs git branch -d	

git branch 查看本地分支
| grep ‘branchName‘ 匹配分支名
| xargs git branch -D 将匹配到的分支名一个一个传递给git branch -D
git branch -D branchName 删除本地分支


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值