Re: Getting rid of a stale remote?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]