{"thread":{"id":"17282","subject":"Deleting remote branch pointed by remote HEAD","startedAt":"2009-01-21T13:02:09Z","lastAt":"2009-03-12T12:50:31Z","messageCount":24,"participants":["Marc-André Lureau","Michael J Gruber","Adeodato Simó","Sitaram Chamarty","Jeff King","Daniel Barkalow","Felipe Contreras","Boyd Stephen Smith Jr.","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101380","messageId":"e29894ca0901210502n1ed1187bm46669a402ab4fe48@mail.gmail.com","threadId":"17282","inReplyTo":null,"subject":"Deleting remote branch pointed by remote HEAD","fromName":"Marc-André Lureau","fromEmail":"marcandre.lureau@gmail.com","sentAt":"2009-01-21T13:02:09Z","receivedAt":"2009-01-21T13:02:09Z","isPatch":false,"sender":{"key":"marcandre.lureau@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9381?v=4"},"body":"Hi\n\nI deleted a remote branch which was pointed by HEAD, this way: \"git\npush origin :master\"\n\nThen for almost every git command, I get this error: \"error:\nrefs/remotes/origin/HEAD points nowhere!\".\n\nI found this situation non-friendly. Fortunately, I could understand\nwhat's going on. But a new user might be confused.\n\nShouldn't the remote HEAD branch be updated or \"protected\" in some\nways? Or should the \"error\" be considered as a \"warning\" (silently?)\n\nWhat do you think?\n\nregards,\n\n-- \nMarc-André Lureau\n"},{"id":"101385","messageId":"49773240.7090605@drmicha.warpmail.net","threadId":"17282","inReplyTo":"e29894ca0901210502n1ed1187bm46669a402ab4fe48@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-21T14:33:36Z","receivedAt":"2009-01-21T14:33:36Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc-André Lureau venit, vidit, dixit 21.01.2009 14:02:\n> Hi\n> \n> I deleted a remote branch which was pointed by HEAD, this way: \"git\n> push origin :master\"\n> \n> Then for almost every git command, I get this error: \"error:\n> refs/remotes/origin/HEAD points nowhere!\".\n\nYou're talking about about the remote git repo, aren't you?\n\n> I found this situation non-friendly. Fortunately, I could understand\n> what's going on. But a new user might be confused.\n> \n> Shouldn't the remote HEAD branch be updated or \"protected\" in some\n> ways? Or should the \"error\" be considered as a \"warning\" (silently?)\n> \n> What do you think?\n\nI think that git said\n\"warning: updating the currently checked out branch; this may cause\nconfusion,\nas the index and working tree do not reflect changes that are now in HEAD.\"\nafter your push and that this may have rung some bells. I also think\nthat pushing to a non-bare remote repo (one with a worktree checked out)\nis strongly advised against in multiple places, unless you know what\nyou're doing - which you seem to do since you were able to restore your\nHEAD ;)\n\nCheers,\nMichael\n"},{"id":"101388","messageId":"e29894ca0901210638t636de791sf27d28893a7a0b65@mail.gmail.com","threadId":"17282","inReplyTo":"49773240.7090605@drmicha.warpmail.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Marc-André Lureau","fromEmail":"marcandre.lureau@gmail.com","sentAt":"2009-01-21T14:38:06Z","receivedAt":"2009-01-21T14:38:06Z","isPatch":false,"sender":{"key":"marcandre.lureau@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9381?v=4"},"body":"On Wed, Jan 21, 2009 at 4:33 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Marc-André Lureau venit, vidit, dixit 21.01.2009 14:02:\n>> Hi\n>>\n>> I deleted a remote branch which was pointed by HEAD, this way: \"git\n>> push origin :master\"\n>>\n>> Then for almost every git command, I get this error: \"error:\n>> refs/remotes/origin/HEAD points nowhere!\".\n>\n> You're talking about about the remote git repo, aren't you?\n>\n\nSure. But the error is on the local repo.\n\n>> I found this situation non-friendly. Fortunately, I could understand\n>> what's going on. But a new user might be confused.\n>>\n>> Shouldn't the remote HEAD branch be updated or \"protected\" in some\n>> ways? Or should the \"error\" be considered as a \"warning\" (silently?)\n>>\n>> What do you think?\n>\n> I think that git said\n> \"warning: updating the currently checked out branch; this may cause\n> confusion,\n> as the index and working tree do not reflect changes that are now in HEAD.\"\n\nIIRC, it only says so if your local repo is on a branch tracking this\nremote. At least, in some conditions, I didn't get this warning. When\nI did second simple testing with git.git version, I also had this\nwarning.\n\n> after your push and that this may have rung some bells. I also think\n> that pushing to a non-bare remote repo (one with a worktree checked out)\n> is strongly advised against in multiple places, unless you know what\n> you're doing - which you seem to do since you were able to restore your\n> HEAD ;)\n\nIsn't HEAD also on non-bare repo, to indicate what is the default branch?\n\nthanks,\n-- \nMarc-André Lureau\n"},{"id":"101389","messageId":"20090121144142.GA18093@chistera.yi.org","threadId":"17282","inReplyTo":"49773240.7090605@drmicha.warpmail.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-21T14:41:42Z","receivedAt":"2009-01-21T14:41:42Z","isPatch":false,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Michael J Gruber [Wed, 21 Jan 2009 15:33:36 +0100]:\n\n> Marc-André Lureau venit, vidit, dixit 21.01.2009 14:02:\n> > Hi\n\n> > I deleted a remote branch which was pointed by HEAD, this way: \"git\n> > push origin :master\"\n\n> > Then for almost every git command, I get this error: \"error:\n> > refs/remotes/origin/HEAD points nowhere!\".\n\n> You're talking about about the remote git repo, aren't you?\n\n> > I found this situation non-friendly. Fortunately, I could understand\n> > what's going on. But a new user might be confused.\n\n> > Shouldn't the remote HEAD branch be updated or \"protected\" in some\n> > ways? Or should the \"error\" be considered as a \"warning\" (silently?)\n\n> > What do you think?\n\n> I think that git said\n> \"warning: updating the currently checked out branch; this may cause\n> confusion,\n> as the index and working tree do not reflect changes that are now in HEAD.\"\n> after your push and that this may have rung some bells. I also think\n> that pushing to a non-bare remote repo (one with a worktree checked out)\n> is strongly advised against in multiple places, unless you know what\n> you're doing - which you seem to do since you were able to restore your\n> HEAD ;)\n\nI don't think Marc-André was pushing to a non-bare repo, but it doesn't\nreally matter, because his issue also shows up with bare repos: if you\ndelete the branch to which HEAD points in a remote repo, you get no\nwarning, and then cloning that bare repo does not fully work, because\nits HEAD points to a non-existent ref.\n\n    % g clone ssh://.../foo.git\n    % cd foo\n    % g push origin :master\n    % cd ..\n    % g clone ssh://.../foo.git foo2\n    ...\n    warning: remote HEAD refers to nonexistent ref, unable to checkout.\n\nWhat would git usefully do in this situation, I don't know. But I\nthought I'd clear up the above confusion.\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \nTruth is the most valuable thing we have, so let's economize it.\n                -- Mark Twain\n"},{"id":"101391","messageId":"slrngnedkm.apk.sitaramc@sitaramc.homelinux.net","threadId":"17282","inReplyTo":"e29894ca0901210502n1ed1187bm46669a402ab4fe48@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-01-21T14:52:07Z","receivedAt":"2009-01-21T14:52:07Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-01-21, Marc-André Lureau <marcandre.lureau@gmail.com> wrote:\n\n> I deleted a remote branch which was pointed by HEAD, this way: \"git\n> push origin :master\"\n>\n> Then for almost every git command, I get this error: \"error:\n> refs/remotes/origin/HEAD points nowhere!\".\n>\n> I found this situation non-friendly. Fortunately, I could understand\n> what's going on. But a new user might be confused.\n\nThat's a pretty advanced command for a beginner.  I have\npeople who're only using the GUI (in the presumption that it\nwill be less confusing or less powerful or whatever) and\nhave managed to right click on a remote branch, choose\n\"checkout this branch\" and have made commits on it without\nknowing they're not on any branch!\n\nI wish I had your problem :-)\n"},{"id":"101392","messageId":"49773E48.90302@drmicha.warpmail.net","threadId":"17282","inReplyTo":"e29894ca0901210638t636de791sf27d28893a7a0b65@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-01-21T15:24:56Z","receivedAt":"2009-01-21T15:24:56Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Marc-André Lureau venit, vidit, dixit 21.01.2009 15:38:\n> On Wed, Jan 21, 2009 at 4:33 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Marc-André Lureau venit, vidit, dixit 21.01.2009 14:02:\n>>> Hi\n>>>\n>>> I deleted a remote branch which was pointed by HEAD, this way: \"git\n>>> push origin :master\"\n>>>\n>>> Then for almost every git command, I get this error: \"error:\n>>> refs/remotes/origin/HEAD points nowhere!\".\n>> You're talking about about the remote git repo, aren't you?\n>>\n> \n> Sure. But the error is on the local repo.\n\nSo, you get these errors on the local repo when dealing with the remote\nrepo, right? I guess this means two things:\n\n1) You are deleting a remote branch\n\n2) Your original report could have been a bit more detailed ;)\n\nIn fact, I'm still unsure about your setup and can't reproduce, unless\n\"almost every git command\" was vastly exaggerated, and Adeodato's\ndescription matches your setup. Does it?\n\nIf yes then git has basically no choice, unless you want git to leave\nHEAD in place as a detached head. This is related to how the symref is\nresolved, which in turn is related to the issue of removing remote\nbranches, which in turn is related to an issue I've been meaning to look\ninto quite a while ago... So, reproducibility would be nice.\n\nCheers,\nMichael\n"},{"id":"101395","messageId":"e29894ca0901210741i14bb2c44uc8222e426c987fc2@mail.gmail.com","threadId":"17282","inReplyTo":"49773E48.90302@drmicha.warpmail.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Marc-André Lureau","fromEmail":"marcandre.lureau@gmail.com","sentAt":"2009-01-21T15:41:34Z","receivedAt":"2009-01-21T15:41:34Z","isPatch":false,"sender":{"key":"marcandre.lureau@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9381?v=4"},"body":"Hi\n\nOn Wed, Jan 21, 2009 at 5:24 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> So, you get these errors on the local repo when dealing with the remote\n> repo, right? I guess this means two things:\n>\n> 1) You are deleting a remote branch\n>\n> 2) Your original report could have been a bit more detailed ;)\n>\n> In fact, I'm still unsure about your setup and can't reproduce, unless\n> \"almost every git command\" was vastly exaggerated, and Adeodato's\n> description matches your setup. Does it?\n>\n\nIt matches. Sorry if I didn't describe the problem correctly.\n\n\"almost every git command\" might be exaggerated. Since I am using bash\nand abusing completion, I get it in the middle of my shell, and it\nconfuses bash. I have to clear my terminal to continue writing my\ncommand (C-l)\n\n> If yes then git has basically no choice, unless you want git to leave\n> HEAD in place as a detached head. This is related to how the symref is\n> resolved, which in turn is related to the issue of removing remote\n> branches, which in turn is related to an issue I've been meaning to look\n> into quite a while ago... So, reproducibility would be nice.\n\nNot sure I follow, but I think Adeodato mail gives you a more detailed\ntest case to reproduce.\n\nthanks,\n\n-- \nMarc-André Lureau\n"},{"id":"101402","messageId":"20090121161940.GA20702@coredump.intra.peff.net","threadId":"17282","inReplyTo":"49773E48.90302@drmicha.warpmail.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-21T16:19:40Z","receivedAt":"2009-01-21T16:19:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 21, 2009 at 04:24:56PM +0100, Michael J Gruber wrote:\n\n> So, you get these errors on the local repo when dealing with the remote\n> repo, right? I guess this means two things:\n> \n> 1) You are deleting a remote branch\n\nActually, he doesn't have to delete the remote branch; somebody else\ncan. The problem is that the HEAD pointer for his remote tracking\nbranches points to a branch that doesn't exist. This can happen because\nwe sometimes update the tracking branches (including deletion) without\nimpacting the HEAD pointer.\n\nThere are two ways that I can think of (and there may be more) to\nprovoke this:\n\n  1. delete a remote branch via push. The local side will helpfully\n     delete your local tracking branch to match what happened on the\n     remote. If it was the remote's HEAD, then you get a broken state\n     (and while we discourage pushing to the remote HEAD on a non-bare\n     repo, it is perfectly OK for a bare one).\n\n  2. somebody else deletes the remote branch that is the HEAD, and you\n     update your tracking branches via \"git remote prune\", which deletes\n     your tracking branches corresponding to any deleted remote branches.\n\nAnd actually there is a slight variant on both of the above. The deleted\nbranch does not actually have to be the current HEAD on the remote. It\njust has to match your _idea_ of the current HEAD on the remote, which\nmay be out of date.\n\nSituation (1) happens entirely locally. So it can be fixed fairly easily\nby checking whether the remote tracking HEAD points to a branch we are\ndeleting, and deleting the HEAD in that case (the code should be in\nbuiltin-send-pack.c:update_tracking_ref). Of course you have probably\nalso created a broken situation on the remote, so perhaps receive-pack\nshould handle that.\n\nSituation (2) could do something similar: when we see that we are about\nto delete the ref pointed to by the remote tracking HEAD, we could\ndelete the HEAD.\n\nBut both situations are a little hack-ish to me. You are deleting the\nHEAD because you don't know what the right value is from the remote end.\nA better fix would be to actually pull the HEAD information down during\nfetch. And I seem to recall a patch about that at some point (it\nrequired a new protocol extension), but I don't know what become of it.\n\nHowever, even if we kept the tracking HEAD totally in sync with the\nremote's HEAD, it still may be possible that the remote HEAD is broken.\nIn which case it might be nice to detect that when pulling it down and\njust leave the tracking HEAD unset.\n\n-Peff\n"},{"id":"101413","messageId":"alpine.LNX.1.00.0901211237530.19665@iabervon.org","threadId":"17282","inReplyTo":"20090121161940.GA20702@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-01-21T18:30:10Z","receivedAt":"2009-01-21T18:30:10Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 21 Jan 2009, Jeff King wrote:\n\n> On Wed, Jan 21, 2009 at 04:24:56PM +0100, Michael J Gruber wrote:\n> \n> > So, you get these errors on the local repo when dealing with the remote\n> > repo, right? I guess this means two things:\n> > \n> > 1) You are deleting a remote branch\n> \n> Actually, he doesn't have to delete the remote branch; somebody else\n> can. The problem is that the HEAD pointer for his remote tracking\n> branches points to a branch that doesn't exist. This can happen because\n> we sometimes update the tracking branches (including deletion) without\n> impacting the HEAD pointer.\n> \n> There are two ways that I can think of (and there may be more) to\n> provoke this:\n> \n>   1. delete a remote branch via push. The local side will helpfully\n>      delete your local tracking branch to match what happened on the\n>      remote. If it was the remote's HEAD, then you get a broken state\n>      (and while we discourage pushing to the remote HEAD on a non-bare\n>      repo, it is perfectly OK for a bare one).\n> \n>   2. somebody else deletes the remote branch that is the HEAD, and you\n>      update your tracking branches via \"git remote prune\", which deletes\n>      your tracking branches corresponding to any deleted remote branches.\n> \n> And actually there is a slight variant on both of the above. The deleted\n> branch does not actually have to be the current HEAD on the remote. It\n> just has to match your _idea_ of the current HEAD on the remote, which\n> may be out of date.\n> \n> Situation (1) happens entirely locally. So it can be fixed fairly easily\n> by checking whether the remote tracking HEAD points to a branch we are\n> deleting, and deleting the HEAD in that case (the code should be in\n> builtin-send-pack.c:update_tracking_ref). Of course you have probably\n> also created a broken situation on the remote, so perhaps receive-pack\n> should handle that.\n> \n> Situation (2) could do something similar: when we see that we are about\n> to delete the ref pointed to by the remote tracking HEAD, we could\n> delete the HEAD.\n> \n> But both situations are a little hack-ish to me. You are deleting the\n> HEAD because you don't know what the right value is from the remote end.\n> A better fix would be to actually pull the HEAD information down during\n> fetch. And I seem to recall a patch about that at some point (it\n> required a new protocol extension), but I don't know what become of it.\n\nThe information is available already; the only thing is that we don't have \na way to know that the user wants to get the remote's suggested HEAD; as \nJunio pointed out at the time, a user might decide that \"next\" is the most \ninteresting branch, and set refs/remotes/origin/HEAD to that branch, and \ntherefore doesn't want it reset to the remote server's value.\n\nThat is, refs/remotes/origin/HEAD is only there to let the user abbreviate \nthe most useful branch of the remote; there's no reason it should reflect \nthe remote's HEAD, except that the remote's HEAD is a good guess if the \nuser hasn't said anything.\n\nI think it might be more appropriate to just care less about a broken \nsymref, explain what's wrong if the user actually tries to use it, and \notherwise mostly ignore it.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"101414","messageId":"94a0d4530901211031s18261776rf8abfddcdcb42402@mail.gmail.com","threadId":"17282","inReplyTo":"20090121161940.GA20702@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2009-01-21T18:31:50Z","receivedAt":"2009-01-21T18:31:50Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Jan 21, 2009 at 6:19 PM, Jeff King <peff@peff.net> wrote:\n> On Wed, Jan 21, 2009 at 04:24:56PM +0100, Michael J Gruber wrote:\n>\n>> So, you get these errors on the local repo when dealing with the remote\n>> repo, right? I guess this means two things:\n>>\n>> 1) You are deleting a remote branch\n>\n> Actually, he doesn't have to delete the remote branch; somebody else\n> can. The problem is that the HEAD pointer for his remote tracking\n> branches points to a branch that doesn't exist. This can happen because\n> we sometimes update the tracking branches (including deletion) without\n> impacting the HEAD pointer.\n>\n> There are two ways that I can think of (and there may be more) to\n> provoke this:\n>\n>  1. delete a remote branch via push. The local side will helpfully\n>     delete your local tracking branch to match what happened on the\n>     remote. If it was the remote's HEAD, then you get a broken state\n>     (and while we discourage pushing to the remote HEAD on a non-bare\n>     repo, it is perfectly OK for a bare one).\n>\n>  2. somebody else deletes the remote branch that is the HEAD, and you\n>     update your tracking branches via \"git remote prune\", which deletes\n>     your tracking branches corresponding to any deleted remote branches.\n>\n> And actually there is a slight variant on both of the above. The deleted\n> branch does not actually have to be the current HEAD on the remote. It\n> just has to match your _idea_ of the current HEAD on the remote, which\n> may be out of date.\n>\n> Situation (1) happens entirely locally. So it can be fixed fairly easily\n> by checking whether the remote tracking HEAD points to a branch we are\n> deleting, and deleting the HEAD in that case (the code should be in\n> builtin-send-pack.c:update_tracking_ref). Of course you have probably\n> also created a broken situation on the remote, so perhaps receive-pack\n> should handle that.\n>\n> Situation (2) could do something similar: when we see that we are about\n> to delete the ref pointed to by the remote tracking HEAD, we could\n> delete the HEAD.\n>\n> But both situations are a little hack-ish to me. You are deleting the\n> HEAD because you don't know what the right value is from the remote end.\n> A better fix would be to actually pull the HEAD information down during\n> fetch. And I seem to recall a patch about that at some point (it\n> required a new protocol extension), but I don't know what become of it.\n>\n> However, even if we kept the tracking HEAD totally in sync with the\n> remote's HEAD, it still may be possible that the remote HEAD is broken.\n> In which case it might be nice to detect that when pulling it down and\n> just leave the tracking HEAD unset.\n\nWhy should we care about the remote HEAD? Isn't that relevant only\nwhen cloning to find out the branch to checkout?\n\nAlso, it's not nice to leave the remote repo with a broken HEAD\npointer, shouldn't git ask for a new head, or fail with a proper\nmessage?\n\n-- \nFelipe Contreras\n"},{"id":"101423","messageId":"200901211309.10120.bss@iguanasuicide.net","threadId":"17282","inReplyTo":"alpine.LNX.1.00.0901211237530.19665@iabervon.org","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2009-01-21T19:09:09Z","receivedAt":"2009-01-21T19:09:09Z","isPatch":false,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Wednesday 21 January 2009, Daniel Barkalow <barkalow@iabervon.org> wrote \nabout 'Re: Deleting remote branch pointed by remote HEAD':\n>I think it might be more appropriate to just care less about a broken\n>symref, explain what's wrong if the user actually tries to use it, and\n>otherwise mostly ignore it.\n\nThat sounds reasonable.  It's not like \"find\" complains about every broken \nsymlink it sees.  Simple traversal or the repository should probably not \ncomplain about every broken symref.\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"101424","messageId":"20090121191219.GD21686@coredump.intra.peff.net","threadId":"17282","inReplyTo":"alpine.LNX.1.00.0901211237530.19665@iabervon.org","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-21T19:12:19Z","receivedAt":"2009-01-21T19:12:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 21, 2009 at 01:30:10PM -0500, Daniel Barkalow wrote:\n\n> The information is available already; the only thing is that we don't have \n> a way to know that the user wants to get the remote's suggested HEAD; as \n> Junio pointed out at the time, a user might decide that \"next\" is the most \n> interesting branch, and set refs/remotes/origin/HEAD to that branch, and \n> therefore doesn't want it reset to the remote server's value.\n> \n> That is, refs/remotes/origin/HEAD is only there to let the user abbreviate \n> the most useful branch of the remote; there's no reason it should reflect \n> the remote's HEAD, except that the remote's HEAD is a good guess if the \n> user hasn't said anything.\n\nGood point. It is probably wrong to just fetch it without asking, then.\n\n> I think it might be more appropriate to just care less about a broken \n> symref, explain what's wrong if the user actually tries to use it, and \n> otherwise mostly ignore it.\n\nI thought about that, but I still wonder if deleting it when the\npointed-to ref is deleted might be more convenient. Remember that\n\"refs/remotes/$foo/HEAD\" can be accessed by a shorthand \"$foo\". So that\nmeans it can impact ref ambiguity lookup. I guess the chance of that\nhappening is fairly unlikely, though.\n\n-Peff\n"},{"id":"101425","messageId":"20090121191408.GA22958@coredump.intra.peff.net","threadId":"17282","inReplyTo":"20090121191219.GD21686@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-21T19:14:08Z","receivedAt":"2009-01-21T19:14:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 21, 2009 at 02:12:19PM -0500, Jeff King wrote:\n\n> > I think it might be more appropriate to just care less about a broken \n> > symref, explain what's wrong if the user actually tries to use it, and \n> > otherwise mostly ignore it.\n> \n> I thought about that, but I still wonder if deleting it when the\n> pointed-to ref is deleted might be more convenient. Remember that\n> \"refs/remotes/$foo/HEAD\" can be accessed by a shorthand \"$foo\". So that\n> means it can impact ref ambiguity lookup. I guess the chance of that\n> happening is fairly unlikely, though.\n\nNot to mention that even without others refs with matching names, it is\nprobably nicer to the user who does try to access it via \"$foo\" to\nsimply say \"there is no $foo\" rather than a confusing error message\nabout a deleted branch that they have to manually fix. And that is\neasily accomplished by deleting such a bogus symref.\n\n-Peff\n"},{"id":"101426","messageId":"20090121191619.GE21686@coredump.intra.peff.net","threadId":"17282","inReplyTo":"94a0d4530901211031s18261776rf8abfddcdcb42402@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-21T19:16:19Z","receivedAt":"2009-01-21T19:16:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 21, 2009 at 08:31:50PM +0200, Felipe Contreras wrote:\n\n> Why should we care about the remote HEAD? Isn't that relevant only\n> when cloning to find out the branch to checkout?\n\nYou can use the shorthand $foo to refer to refs/remotes/$foo/HEAD. Which\nmeans, in the default case, you can refer to just \"origin\" to talk about\norigin's master branch.\n\nBut as Daniel noted, that is really about local preference for \"what is\nthe most interesting branch on the remote\". You might want to track what\nthe remote sets to HEAD, or you might want to set it individually.\n\n-Peff\n"},{"id":"101428","messageId":"94a0d4530901211120o4d06c813l3abf86c657a7ee16@mail.gmail.com","threadId":"17282","inReplyTo":"20090121191619.GE21686@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2009-01-21T19:20:21Z","receivedAt":"2009-01-21T19:20:21Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Jan 21, 2009 at 9:16 PM, Jeff King <peff@peff.net> wrote:\n> On Wed, Jan 21, 2009 at 08:31:50PM +0200, Felipe Contreras wrote:\n>\n>> Why should we care about the remote HEAD? Isn't that relevant only\n>> when cloning to find out the branch to checkout?\n>\n> You can use the shorthand $foo to refer to refs/remotes/$foo/HEAD. Which\n> means, in the default case, you can refer to just \"origin\" to talk about\n> origin's master branch.\n>\n> But as Daniel noted, that is really about local preference for \"what is\n> the most interesting branch on the remote\". You might want to track what\n> the remote sets to HEAD, or you might want to set it individually.\n\nAh, good to know. But then the message should appear only when doing\nsomething with the $foo branch.\n\n-- \nFelipe Contreras\n"},{"id":"101433","messageId":"alpine.LNX.1.00.0901211443140.19665@iabervon.org","threadId":"17282","inReplyTo":"20090121191408.GA22958@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-01-21T19:50:40Z","receivedAt":"2009-01-21T19:50:40Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 21 Jan 2009, Jeff King wrote:\n\n> On Wed, Jan 21, 2009 at 02:12:19PM -0500, Jeff King wrote:\n> \n> > > I think it might be more appropriate to just care less about a broken \n> > > symref, explain what's wrong if the user actually tries to use it, and \n> > > otherwise mostly ignore it.\n> > \n> > I thought about that, but I still wonder if deleting it when the\n> > pointed-to ref is deleted might be more convenient. Remember that\n> > \"refs/remotes/$foo/HEAD\" can be accessed by a shorthand \"$foo\". So that\n> > means it can impact ref ambiguity lookup. I guess the chance of that\n> > happening is fairly unlikely, though.\n> \n> Not to mention that even without others refs with matching names, it is\n> probably nicer to the user who does try to access it via \"$foo\" to\n> simply say \"there is no $foo\" rather than a confusing error message\n> about a deleted branch that they have to manually fix. And that is\n> easily accomplished by deleting such a bogus symref.\n\nI think the ideal thing is to keep the symref as a reminder and just give \na non-confusing error message instead of a confusing one. E.g.:\n\n\"\"\"\n$foo is set to mean the tracking branch $foo/bar, which does not exist. \nUse:\n\n  git remote set-default $foo <name>\n\nto set a new default branch for $foo.\n\"\"\"\n\n(And, of course, add that subcommand to remote)\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"101435","messageId":"20090121195348.GB3589@sigill.intra.peff.net","threadId":"17282","inReplyTo":"alpine.LNX.1.00.0901211443140.19665@iabervon.org","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-21T19:53:48Z","receivedAt":"2009-01-21T19:53:48Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jan 21, 2009 at 02:50:40PM -0500, Daniel Barkalow wrote:\n\n> I think the ideal thing is to keep the symref as a reminder and just give \n> a non-confusing error message instead of a confusing one. E.g.:\n> \n> \"\"\"\n> $foo is set to mean the tracking branch $foo/bar, which does not exist. \n> Use:\n> \n>   git remote set-default $foo <name>\n> \n> to set a new default branch for $foo.\n> \"\"\"\n> \n> (And, of course, add that subcommand to remote)\n\nI think that would be reasonable behavior (and probably a special mode\nfor set-default to just update from the remote's idea of HEAD).\n\n-Peff\n"},{"id":"101440","messageId":"7veiywe6h8.fsf@gitster.siamese.dyndns.org","threadId":"17282","inReplyTo":"alpine.LNX.1.00.0901211237530.19665@iabervon.org","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-21T20:42:27Z","receivedAt":"2009-01-21T20:42:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> That is, refs/remotes/origin/HEAD is only there to let the user abbreviate \n> the most useful branch of the remote; there's no reason it should reflect \n> the remote's HEAD, except that the remote's HEAD is a good guess if the \n> user hasn't said anything.\n>\n> I think it might be more appropriate to just care less about a broken \n> symref, explain what's wrong if the user actually tries to use it, and \n> otherwise mostly ignore it.\n\nI agree with you in many of the points in your message.\n\nThe user used to be able to say \"origin\" as a shorthand for \"origin/frotz\"\nby having \"remotes/origin/HEAD\" locally, and somebody (not necessarily the\nuser himself) broke this arrangement.  Silently discarding HEAD will lose\nthe information on which remote branch was the interesting one for the\nuser.  It may also change the disambiguation rules for \"origin\" without\ntelling the user.  Neither is desirable.\n\nThe tool needs a better explanation of the situation.  We also want an\neasier way to help the user repoint the HEAD to something else, or remove\nthe dangling HEAD than telling him to use symbolic-ref.\n"},{"id":"101473","messageId":"alpine.LNX.1.00.0901211705280.19665@iabervon.org","threadId":"17282","inReplyTo":"slrngnedkm.apk.sitaramc@sitaramc.homelinux.net","subject":"GUI and detatched HEAD (was Re: Deleting remote branch pointed by remote HEAD)","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-01-21T22:56:43Z","receivedAt":"2009-01-21T22:56:43Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 21 Jan 2009, Sitaram Chamarty wrote:\n\n> On 2009-01-21, Marc-André Lureau <marcandre.lureau@gmail.com> wrote:\n> \n> > I deleted a remote branch which was pointed by HEAD, this way: \"git\n> > push origin :master\"\n> >\n> > Then for almost every git command, I get this error: \"error:\n> > refs/remotes/origin/HEAD points nowhere!\".\n> >\n> > I found this situation non-friendly. Fortunately, I could understand\n> > what's going on. But a new user might be confused.\n> \n> That's a pretty advanced command for a beginner.  I have\n> people who're only using the GUI (in the presumption that it\n> will be less confusing or less powerful or whatever) and\n> have managed to right click on a remote branch, choose\n> \"checkout this branch\" and have made commits on it without\n> knowing they're not on any branch!\n\nI wonder if the GUI could handle this in a way that users would \nunderstand. This is qualitively like following a link to a spreadsheet in \nyour web browser, having the browser launch your office suite and load the \nspreadsheet off the web; now you're interacting with a spreadsheet where \nyou obviously can't save to the original location (which is some web site) \nand haven't provided a local filename to save as.\n\nI think the right thing would be to show it as \"(Untitled)\" and have a \nprominant button to make a real saved branch out of it. There's nothing \nall that strange about having a current \"document\" that has no filename \nyet; the strange thing is that a version control system has this \ncapability.\n\n\t-Daniel\n*This .sig left intentionally blank*"},{"id":"101529","messageId":"slrngnh051.hdg.sitaramc@sitaramc.homelinux.net","threadId":"17282","inReplyTo":"alpine.LNX.1.00.0901211705280.19665@iabervon.org","subject":"Re: GUI and detatched HEAD (was Re: Deleting remote branch pointed by remote HEAD)","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-01-22T14:20:17Z","receivedAt":"2009-01-22T14:20:17Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-01-21, Daniel Barkalow <barkalow@iabervon.org> wrote:\n> On Wed, 21 Jan 2009, Sitaram Chamarty wrote:\n>> have managed to right click on a remote branch, choose\n>> \"checkout this branch\" and have made commits on it without\n>> knowing they're not on any branch!\n>\n> I wonder if the GUI could handle this in a way that users would \n> understand. This is qualitively like following a link to a spreadsheet in \n\nI'd be happy with a simple warning message saying \"are you\nsure you know what you are doing?\" or words to that effect\n:-)\n"},{"id":"107784","messageId":"94a0d4530903120202w22f1f8ecwc6b4d22652afc427@mail.gmail.com","threadId":"17282","inReplyTo":"20090121195348.GB3589@sigill.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2009-03-12T09:02:08Z","receivedAt":"2009-03-12T09:02:08Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Wed, Jan 21, 2009 at 9:53 PM, Jeff King <peff@peff.net> wrote:\n> On Wed, Jan 21, 2009 at 02:50:40PM -0500, Daniel Barkalow wrote:\n>\n>> I think the ideal thing is to keep the symref as a reminder and just give\n>> a non-confusing error message instead of a confusing one. E.g.:\n>>\n>> \"\"\"\n>> $foo is set to mean the tracking branch $foo/bar, which does not exist.\n>> Use:\n>>\n>>   git remote set-default $foo <name>\n>>\n>> to set a new default branch for $foo.\n>> \"\"\"\n>>\n>> (And, of course, add that subcommand to remote)\n>\n> I think that would be reasonable behavior (and probably a special mode\n> for set-default to just update from the remote's idea of HEAD).\n\nNobody is working on this, right?\n\n-- \nFelipe Contreras\n"},{"id":"107805","messageId":"20090312113908.GA19572@coredump.intra.peff.net","threadId":"17282","inReplyTo":"94a0d4530903120202w22f1f8ecwc6b4d22652afc427@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-12T11:39:08Z","receivedAt":"2009-03-12T11:39:08Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:\n\n> >>   git remote set-default $foo <name>\n> [...]\n> > I think that would be reasonable behavior (and probably a special mode\n> > for set-default to just update from the remote's idea of HEAD).\n> \n> Nobody is working on this, right?\n\nJay has a number of improvements to \"git remote\" in next, including\nthis. See 104a914 (Merge branch 'js/remote-improvements' into next,\n2009-03-05). Especially bc14fac (builtin-remote: add set-head\nsubcommand, 2009-02-25).\n\n-Peff\n"},{"id":"107820","messageId":"94a0d4530903120547rfbbaccra8ee68498688fa54@mail.gmail.com","threadId":"17282","inReplyTo":"20090312113908.GA19572@coredump.intra.peff.net","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2009-03-12T12:47:24Z","receivedAt":"2009-03-12T12:47:24Z","isPatch":false,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Mar 12, 2009 at 1:39 PM, Jeff King <peff@peff.net> wrote:\n> On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:\n>\n>> >>   git remote set-default $foo <name>\n>> [...]\n>> > I think that would be reasonable behavior (and probably a special mode\n>> > for set-default to just update from the remote's idea of HEAD).\n>>\n>> Nobody is working on this, right?\n>\n> Jay has a number of improvements to \"git remote\" in next, including\n> this. See 104a914 (Merge branch 'js/remote-improvements' into next,\n> 2009-03-05). Especially bc14fac (builtin-remote: add set-head\n> subcommand, 2009-02-25).\n\nYes, I looked at that, but set-head will only change the remote HEAD locally.\n\n-- \nFelipe Contreras\n"},{"id":"107822","messageId":"20090312125031.GA20381@coredump.intra.peff.net","threadId":"17282","inReplyTo":"94a0d4530903120547rfbbaccra8ee68498688fa54@mail.gmail.com","subject":"Re: Deleting remote branch pointed by remote HEAD","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-03-12T12:50:31Z","receivedAt":"2009-03-12T12:50:31Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Mar 12, 2009 at 02:47:24PM +0200, Felipe Contreras wrote:\n\n> On Thu, Mar 12, 2009 at 1:39 PM, Jeff King <peff@peff.net> wrote:\n> > On Thu, Mar 12, 2009 at 11:02:08AM +0200, Felipe Contreras wrote:\n> >\n> >> >>   git remote set-default $foo <name>\n> >> [...]\n> >> > I think that would be reasonable behavior (and probably a special mode\n> >> > for set-default to just update from the remote's idea of HEAD).\n> >>\n> >> Nobody is working on this, right?\n> >\n> > Jay has a number of improvements to \"git remote\" in next, including\n> > this. See 104a914 (Merge branch 'js/remote-improvements' into next,\n> > 2009-03-05). Especially bc14fac (builtin-remote: add set-head\n> > subcommand, 2009-02-25).\n> \n> Yes, I looked at that, but set-head will only change the remote HEAD locally.\n\nThat was what the thread you were replying to was about. If you are\nproposing a command to set the HEAD in a remote repository, then no, I\ndon't think anybody is working on that.\n\n-Peff\n"}]}