{"thread":{"id":"23360","subject":"Getting rid of a stale remote?","startedAt":"2010-04-06T18:03:55Z","lastAt":"2010-04-09T02:08:35Z","messageCount":5,"participants":["Tim Visher","Ramkumar Ramachandra","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"138771","messageId":"x2jc115fd3c1004061103z3154b6b3ge34493260f12925e@mail.gmail.com","threadId":"23360","inReplyTo":null,"subject":"Getting rid of a stale remote?","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2010-04-06T18:03:55Z","receivedAt":"2010-04-06T18:03:55Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"Hello Everyone,\n\nI'm trying to get rid of a stale remote.  I deleted the remote via\n`git remote rm <remote>` and that removed it from .git/config but for\nsome reason the references stayed in the listing of `git branch -a`.\n\nHow do I get rid of the listing in `git branch`?\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"},{"id":"138772","messageId":"w2if3271551004061107rb25b83b9p19a284f19e7d4f87@mail.gmail.com","threadId":"23360","inReplyTo":"x2jc115fd3c1004061103z3154b6b3ge34493260f12925e@mail.gmail.com","subject":"Re: Getting rid of a stale remote?","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-04-06T18:07:40Z","receivedAt":"2010-04-06T18:07:40Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"> I'm trying to get rid of a stale remote.  I deleted the remote via\n> `git remote rm <remote>` and that removed it from .git/config but for\n> some reason the references stayed in the listing of `git branch -a`.\n\nSee `git remote prune`.\n\n-- Ram\n"},{"id":"138773","messageId":"x2uc115fd3c1004061125i695f66bbi9f949ccc1958750@mail.gmail.com","threadId":"23360","inReplyTo":"w2if3271551004061107rb25b83b9p19a284f19e7d4f87@mail.gmail.com","subject":"Re: Getting rid of a stale remote?","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2010-04-06T18:25:07Z","receivedAt":"2010-04-06T18:25:07Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"On Tue, Apr 6, 2010 at 2:07 PM, Ramkumar Ramachandra <artagnon@gmail.com> wrote:\n>> I'm trying to get rid of a stale remote.  I deleted the remote via\n>> `git remote rm <remote>` and that removed it from .git/config but for\n>> some reason the references stayed in the listing of `git branch -a`.\n>\n> See `git remote prune`.\n\nFrom the remote man page:\n>   prune\n>       Deletes all stale tracking branches under <name>. These stale branches\n>       have already been removed from the remote repository referenced by\n>       <name>, but are still locally available in \"remotes/<name>\".\n\nI'm unclear as to how this solves my problem.  Consider the following:\n\n    $ git remote\n    a\n    b\n    c\n    $ git branch -a\n    a\n    b\n    c\n    remotes/a/branch\n    remotes/b/branch\n    remotes/c/branch\n    remotes/d/branch\n    $ git remote prune d\n    fatal: 'd' does not appear to be a git repository\n    fatal: The remote end hung up unexpectedly\n    $ git remote rm d\n    error: Could not remove config section 'remote.d'\n\nI would like to get rid of the `remotes/d/branch` entry.\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"},{"id":"138774","messageId":"20100406184256.GA14281@coredump.intra.peff.net","threadId":"23360","inReplyTo":"x2uc115fd3c1004061125i695f66bbi9f949ccc1958750@mail.gmail.com","subject":"Re: Getting rid of a stale remote?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-04-06T18:42:56Z","receivedAt":"2010-04-06T18:42:56Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 06, 2010 at 02:25:07PM -0400, Tim Visher wrote:\n\n> >   prune\n> >       Deletes all stale tracking branches under <name>. These stale branches\n> >       have already been removed from the remote repository referenced by\n> >       <name>, but are still locally available in \"remotes/<name>\".\n> \n> I'm unclear as to how this solves my problem.  Consider the following:\n\nIt doesn't. Prune is about removing stale branches of _existing_\nremotes, but you want to remove the whole remote.\n\n>     $ git remote\n>     a\n>     b\n>     c\n\nSo you don't have a remote 'd' at this point.\n\n>     $ git branch -a\n>     a\n>     b\n>     c\n>     remotes/a/branch\n>     remotes/b/branch\n>     remotes/c/branch\n>     remotes/d/branch\n\nBut you do have a crufty tracking branch.\n\n>     $ git remote prune d\n>     fatal: 'd' does not appear to be a git repository\n>     fatal: The remote end hung up unexpectedly\n\nYou don't have a remote 'd', so we try to a git repository in the\ndirectory 'd'. Which obviously doesn't work.\n\n>     $ git remote rm d\n>     error: Could not remove config section 'remote.d'\n\nAnd this fails because you have no configured remote 'd', just the\ncrufty branch. How you got into that state, I don't know, but I imagine\nit was from deleting the config in .git/config manually instead of using\n\"git remote rm\" in the first place.\n\nIt would be tempting to say that \"git remote rm\" should continue if the\nconfig simply doesn't exist and remove the crufty branch, but that is\nnot quite right. We actually need the config to tell us \"here is where\nwe store the tracking branches for remote d\". Of course, unless you have\nmunged the config manually, it will always be \"refs/remotes/d\". So we\ncould perhaps guess that for the case of missing config (possibly with\n\"git remote rm -f\" or something).\n\nBut if you just want to do things manually, try \"git branch -d -r\nd/branch\".\n\n-Peff\n"},{"id":"138996","messageId":"m2nc115fd3c1004081908t15ee034bha4909b56621b4936@mail.gmail.com","threadId":"23360","inReplyTo":"20100406184256.GA14281@coredump.intra.peff.net","subject":"Re: Getting rid of a stale remote?","fromName":"Tim Visher","fromEmail":"tim.visher@gmail.com","sentAt":"2010-04-09T02:08:35Z","receivedAt":"2010-04-09T02:08:35Z","isPatch":false,"sender":{"key":"tim.visher@gmail.com","avatar":"https://gravatar.com/avatar/98307ce54bcac1a46b5d845827d5386e2a27895ff08790cdd3877ad527760575?d=mp&s=160"},"body":"On Tue, Apr 6, 2010 at 2:42 PM, Jeff King <peff@peff.net> wrote:\n> On Tue, Apr 06, 2010 at 02:25:07PM -0400, Tim Visher wrote:\n>>     $ git remote rm d\n>>     error: Could not remove config section 'remote.d'\n>\n> And this fails because you have no configured remote 'd', just the\n> crufty branch. How you got into that state, I don't know, but I imagine\n> it was from deleting the config in .git/config manually instead of using\n> \"git remote rm\" in the first place.\n\n%<---lengthy but almost assuredly misleading explanation of how I got there--->%\n\nSo I had this long explanation but I realized that it probably wasn't\nthe case.  If I ever run into this again I'll try to be more aware of\nwhat I did.  I suspect though that it's when I want to make one remote\nmy origin and make origin something else…\n\n> It would be tempting to say that \"git remote rm\" should continue if the\n> config simply doesn't exist and remove the crufty branch, but that is\n> not quite right. We actually need the config to tell us \"here is where\n> we store the tracking branches for remote d\". Of course, unless you have\n> munged the config manually, it will always be \"refs/remotes/d\". So we\n> could perhaps guess that for the case of missing config (possibly with\n> \"git remote rm -f\" or something).\n\nThat sounds quite sensible to me.  Also, a message along the lines of:\n\n    You are trying to delete a remote for which there is no config section.  (We\n    discovered a remote X in refs/remotes/X) and deleted it.|No remote X in\n    refs/remotes/X. Did you store it elsewhere?)  In the future, use `git\n    remote` to alter your remotes\n\n> But if you just want to do things manually, try \"git branch -d -r\n> d/branch\".\n\nThat did indeed work like a charm.  Thanks so much.\n\n-- \n\nIn Christ,\n\nTimmy V.\n\nhttp://burningones.com/\nhttp://five.sentenc.es/ - Spend less time on e-mail\n"}]}