# garbage collection following a "git remote rm"?

2 messages from 2018-09-15 to 2018-09-15. Participants: Robert P. J. Day, Junio C Hamano.
Thread: https://gitlist.dev/t/49353

## Robert P. J. Day, 2018-09-15 14:31

Subject: garbage collection following a "git remote rm"?
Message-ID: <alpine.LFD.2.21.1809151027350.17253@localhost.localdomain>
URL: https://gitlist.dev/e/alpine.LFD.2.21.1809151027350.17253%40localhost.localdomain

```

  i've never checked before, but i assume that if i add a remote, then
fetch from it and subsequently remove that remote, all of the
now-unreferenced remote tracking branches in the object store will
eventually be discarded by garbage collection, yes?

  is there a command (git fsck?) that would display exclusively
objects in the object store corresponding to objects that are suddenly
unreferenced due to the removal of a remote? i was just curious as it
would be neat to demo that in a class.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

```

## Junio C Hamano, 2018-09-15 16:00

Subject: Re: garbage collection following a "git remote rm"?
Message-ID: <xmqqh8iqagyv.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqh8iqagyv.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <alpine.LFD.2.21.1809151027350.17253@localhost.localdomain>

```
"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

>   is there a command (git fsck?) that would display exclusively
> objects in the object store corresponding to objects that are suddenly
> unreferenced due to the removal of a remote?

fsck gives you dangling ones (and can be told to give you
unreachable ones, too) but the list will be more like "these are
unreachable, period".  It won't be like "these are the ones that
recently became unreacable, and I am not listing ones that were
unreachable already in N hours ago".


```
