threads / discuss / 46108

How do I regularly clean up .git/objects/pack/tmp_* files?

Subject: How do I regularly clean up .git/objects/pack/tmp_* files?

## tl;dr

2 messages between Jun 3, 2017 and Jun 4, 2017.

replies: 1people: 2as markdown or json

Dun Peal· Jun 3, 2017, 20:53 UTC · lore
Hi there,

I try to follow the best practice of regular repo maintenance, which afaik consists of running `git gc` every week or so.

So I thought I had a well-maintained repository, and was quite surprised to discover some very large .git/objects/pack/tmp_* files, which apparently are entirely needless and should be cleaned up, but `git gc` doesn't clean them.

Is there another command I should regularly run, instead or in addition to `git gc`, to keep my repo well-maintained, and specifically, to remove such unnecessary files from my .git directory?

Thanks, D.
Jeff King· Jun 4, 2017, 05:17 UTC · re: Dun Peal · lore

Re: How do I regularly clean up .git/objects/pack/tmp_* files?

On Sat, Jun 03, 2017 at 04:53:20PM -0400, Dun Peal wrote:
Show 11 quoted lines
> I try to follow the best practice of regular repo maintenance, which
> afaik consists of running `git gc` every week or so.
> 
> So I thought I had a well-maintained repository, and was quite
> surprised to discover some very large .git/objects/pack/tmp_* files,
> which apparently are entirely needless and should be cleaned up, but
> `git gc` doesn't clean them.
> 
> Is there another command I should regularly run, instead or in
> addition to `git gc`, to keep my repo well-maintained, and
> specifically, to remove such unnecessary files from my .git directory?

They're kept with the same time-based grace period that is used for unreachable objects, which defaults to the rather conservative "2 weeks". Try "git gc --prune=1.hour.ago".

-Peff

← back to recent threads