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

2 messages from 2017-06-03 to 2017-06-04. Participants: Dun Peal, Jeff King.
Thread: https://gitlist.dev/t/46108

## Dun Peal, 2017-06-03 20:53

Subject: How do I regularly clean up .git/objects/pack/tmp_* files?
Message-ID: <CAD03jn5CEwZ0H+UKO4yW3PoL+XPXcwUGnehhv-KyBYQCYzAXGQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAD03jn5CEwZ0H%2BUKO4yW3PoL%2BXPXcwUGnehhv-KyBYQCYzAXGQ%40mail.gmail.com

```
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, 2017-06-04 05:17

Subject: Re: How do I regularly clean up .git/objects/pack/tmp_* files?
Message-ID: <20170604051740.gnkrjv35udgipg42@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20170604051740.gnkrjv35udgipg42%40sigill.intra.peff.net
In-Reply-To: <CAD03jn5CEwZ0H+UKO4yW3PoL+XPXcwUGnehhv-KyBYQCYzAXGQ@mail.gmail.com>

```
On Sat, Jun 03, 2017 at 04:53:20PM -0400, Dun Peal wrote:

> 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

```
