git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Tim Visher <tim.visher@gmail.com>
Cc: Ramkumar Ramachandra <artagnon@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Getting rid of a stale remote?
Date: Tue, 6 Apr 2010 14:42:56 -0400	[thread overview]
Message-ID: <20100406184256.GA14281@coredump.intra.peff.net> (raw)
In-Reply-To: <x2uc115fd3c1004061125i695f66bbi9f949ccc1958750@mail.gmail.com>

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

  reply	other threads:[~2010-04-06 18:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-04-09  2:08       ` Tim Visher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100406184256.GA14281@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=tim.visher@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).