git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting rid of a stale remote?
@ 2010-04-06 18:03 Tim Visher
  2010-04-06 18:07 ` Ramkumar Ramachandra
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Visher @ 2010-04-06 18:03 UTC (permalink / raw)
  To: Git Mailing List

Hello Everyone,

I'm trying to get rid of a stale remote.  I deleted the remote via
`git remote rm <remote>` and that removed it from .git/config but for
some reason the references stayed in the listing of `git branch -a`.

How do I get rid of the listing in `git branch`?

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting rid of a stale remote?
  2010-04-06 18:03 Getting rid of a stale remote? Tim Visher
@ 2010-04-06 18:07 ` Ramkumar Ramachandra
  2010-04-06 18:25   ` Tim Visher
  0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2010-04-06 18:07 UTC (permalink / raw)
  To: Tim Visher; +Cc: Git Mailing List

> I'm trying to get rid of a stale remote.  I deleted the remote via
> `git remote rm <remote>` and that removed it from .git/config but for
> some reason the references stayed in the listing of `git branch -a`.

See `git remote prune`.

-- Ram

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting rid of a stale remote?
  2010-04-06 18:07 ` Ramkumar Ramachandra
@ 2010-04-06 18:25   ` Tim Visher
  2010-04-06 18:42     ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Visher @ 2010-04-06 18:25 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git Mailing List

On Tue, Apr 6, 2010 at 2:07 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>> I'm trying to get rid of a stale remote.  I deleted the remote via
>> `git remote rm <remote>` and that removed it from .git/config but for
>> some reason the references stayed in the listing of `git branch -a`.
>
> See `git remote prune`.

From the remote man page:
>   prune
>       Deletes all stale tracking branches under <name>. These stale branches
>       have already been removed from the remote repository referenced by
>       <name>, but are still locally available in "remotes/<name>".

I'm unclear as to how this solves my problem.  Consider the following:

    $ git remote
    a
    b
    c
    $ git branch -a
    a
    b
    c
    remotes/a/branch
    remotes/b/branch
    remotes/c/branch
    remotes/d/branch
    $ git remote prune d
    fatal: 'd' does not appear to be a git repository
    fatal: The remote end hung up unexpectedly
    $ git remote rm d
    error: Could not remove config section 'remote.d'

I would like to get rid of the `remotes/d/branch` entry.

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting rid of a stale remote?
  2010-04-06 18:25   ` Tim Visher
@ 2010-04-06 18:42     ` Jeff King
  2010-04-09  2:08       ` Tim Visher
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2010-04-06 18:42 UTC (permalink / raw)
  To: Tim Visher; +Cc: Ramkumar Ramachandra, Git Mailing List

On Tue, Apr 06, 2010 at 02:25:07PM -0400, Tim Visher wrote:

> >   prune
> >       Deletes all stale tracking branches under <name>. These stale branches
> >       have already been removed from the remote repository referenced by
> >       <name>, but are still locally available in "remotes/<name>".
> 
> I'm unclear as to how this solves my problem.  Consider the following:

It doesn't. Prune is about removing stale branches of _existing_
remotes, but you want to remove the whole remote.

>     $ git remote
>     a
>     b
>     c

So you don't have a remote 'd' at this point.

>     $ git branch -a
>     a
>     b
>     c
>     remotes/a/branch
>     remotes/b/branch
>     remotes/c/branch
>     remotes/d/branch

But you do have a crufty tracking branch.

>     $ git remote prune d
>     fatal: 'd' does not appear to be a git repository
>     fatal: The remote end hung up unexpectedly

You don't have a remote 'd', so we try to a git repository in the
directory 'd'. Which obviously doesn't work.

>     $ git remote rm d
>     error: Could not remove config section 'remote.d'

And this fails because you have no configured remote 'd', just the
crufty branch. How you got into that state, I don't know, but I imagine
it was from deleting the config in .git/config manually instead of using
"git remote rm" in the first place.

It would be tempting to say that "git remote rm" should continue if the
config simply doesn't exist and remove the crufty branch, but that is
not quite right. We actually need the config to tell us "here is where
we store the tracking branches for remote d". Of course, unless you have
munged the config manually, it will always be "refs/remotes/d". So we
could perhaps guess that for the case of missing config (possibly with
"git remote rm -f" or something).

But if you just want to do things manually, try "git branch -d -r
d/branch".

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Getting rid of a stale remote?
  2010-04-06 18:42     ` Jeff King
@ 2010-04-09  2:08       ` Tim Visher
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Visher @ 2010-04-09  2:08 UTC (permalink / raw)
  To: Jeff King; +Cc: Ramkumar Ramachandra, Git Mailing List

On Tue, Apr 6, 2010 at 2:42 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Apr 06, 2010 at 02:25:07PM -0400, Tim Visher wrote:
>>     $ git remote rm d
>>     error: Could not remove config section 'remote.d'
>
> And this fails because you have no configured remote 'd', just the
> crufty branch. How you got into that state, I don't know, but I imagine
> it was from deleting the config in .git/config manually instead of using
> "git remote rm" in the first place.

%<---lengthy but almost assuredly misleading explanation of how I got there--->%

So I had this long explanation but I realized that it probably wasn't
the case.  If I ever run into this again I'll try to be more aware of
what I did.  I suspect though that it's when I want to make one remote
my origin and make origin something else…

> It would be tempting to say that "git remote rm" should continue if the
> config simply doesn't exist and remove the crufty branch, but that is
> not quite right. We actually need the config to tell us "here is where
> we store the tracking branches for remote d". Of course, unless you have
> munged the config manually, it will always be "refs/remotes/d". So we
> could perhaps guess that for the case of missing config (possibly with
> "git remote rm -f" or something).

That sounds quite sensible to me.  Also, a message along the lines of:

    You are trying to delete a remote for which there is no config section.  (We
    discovered a remote X in refs/remotes/X) and deleted it.|No remote X in
    refs/remotes/X. Did you store it elsewhere?)  In the future, use `git
    remote` to alter your remotes

> But if you just want to do things manually, try "git branch -d -r
> d/branch".

That did indeed work like a charm.  Thanks so much.

-- 

In Christ,

Timmy V.

http://burningones.com/
http://five.sentenc.es/ - Spend less time on e-mail

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-09  2:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-06 18:03 Getting rid of a stale remote? Tim Visher
2010-04-06 18:07 ` Ramkumar Ramachandra
2010-04-06 18:25   ` Tim Visher
2010-04-06 18:42     ` Jeff King
2010-04-09  2:08       ` Tim Visher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).