{"thread":{"id":"17244","subject":"[HELP] A local branch has disappeared","startedAt":"2009-01-19T03:54:04Z","lastAt":"2009-01-19T07:16:00Z","messageCount":3,"participants":["Johnny Lee","Neil Macneale"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101094","messageId":"488807870901181954p558756f5v94c8a6681125e8bb@mail.gmail.com","threadId":"17244","inReplyTo":null,"subject":"[HELP] A local branch has disappeared","fromName":"Johnny Lee","fromEmail":"johnnylee194@gmail.com","sentAt":"2009-01-19T03:54:04Z","receivedAt":"2009-01-19T03:54:04Z","isPatch":false,"sender":{"key":"johnnylee194@gmail.com","avatar":"https://gravatar.com/avatar/88def25aef325f1ca5607d6009a3f9663fcc2db6adfa93f7bd999c098710189f?d=mp&s=160"},"body":"Hi all,\n\nToday I found my current branch (named cupcake) has disappeared.\ngit@tomato:~/golf$ git branch -a\n  htc_cupcake\n  tmo_cupcake\n  origin/HEAD\n  origin/cupcake\n  origin/device\n\nAs you can see, there is no \"*\" to mark the current branch.\n\nBut when I check the HEAD, it still pointed to the cupcake branch\ngit@tomato:~/golf$ cat .git/HEAD\nref: refs/heads/cupcake\n\nBut when I check the ref/heads, the cupcake is missing\ngit@tomato:~/golf$ ls .git/refs/heads/\nhtc_cupcake  tmo_cupcake\n\nAnd the cupcake in still in the config:\ngit@tomato:~/golf$ cat .git/config\n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n        sharedRepository = 1\n[remote \"origin\"]\n        url = /home/rick/golfresort/device/.git\n        fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"cupcake\"]\n        remote = origin\n        merge = refs/heads/cupcake\n\nI'm confused:\n1. I didn't do any aggressive operations. Why the branch has\ndisappeared? Normally I have done these operation for this repo:\n   i. pull from parent repo\n   ii. cloned by children repo\n   iii. pulled by children repo\n   iv. pushed from children repo\n2. Is there any way to resume the cupcake branch? Can I manually add\nthe cupcake to ref/heads?\n\nThanks very much for your considerations,\nJohnny\n-- \nwe all have our crosses to bear\n"},{"id":"101103","messageId":"A9C9E16F-B1CC-4E0A-AEF1-426ABEF60BDF@theory.org","threadId":"17244","inReplyTo":"488807870901181954p558756f5v94c8a6681125e8bb@mail.gmail.com","subject":"Re: [HELP] A local branch has disappeared","fromName":"Neil Macneale","fromEmail":"mac4@theory.org","sentAt":"2009-01-19T05:37:54Z","receivedAt":"2009-01-19T05:37:54Z","isPatch":false,"sender":{"key":"mac4@theory.org","avatar":null},"body":"\nOn Jan 18, 2009, at 7:54 PM, Johnny Lee wrote:\n\n> Hi all,\n>\n> Today I found my current branch (named cupcake) has disappeared.\n> git@tomato:~/golf$ git branch -a\n>  htc_cupcake\n>  tmo_cupcake\n>  origin/HEAD\n>  origin/cupcake\n>  origin/device\n>\n> As you can see, there is no \"*\" to mark the current branch.\n>\n> But when I check the HEAD, it still pointed to the cupcake branch\n> git@tomato:~/golf$ cat .git/HEAD\n> ref: refs/heads/cupcake\n>\n> But when I check the ref/heads, the cupcake is missing\n> git@tomato:~/golf$ ls .git/refs/heads/\n> htc_cupcake  tmo_cupcake\n>\n> And the cupcake in still in the config:\n> git@tomato:~/golf$ cat .git/config\n> [core]\n>        repositoryformatversion = 0\n>        filemode = true\n>        bare = false\n>        logallrefupdates = true\n>        sharedRepository = 1\n> [remote \"origin\"]\n>        url = /home/rick/golfresort/device/.git\n>        fetch = +refs/heads/*:refs/remotes/origin/*\n> [branch \"cupcake\"]\n>        remote = origin\n>        merge = refs/heads/cupcake\n>\n> I'm confused:\n> 1. I didn't do any aggressive operations. Why the branch has\n> disappeared? Normally I have done these operation for this repo:\n>   i. pull from parent repo\n>   ii. cloned by children repo\n>   iii. pulled by children repo\n>   iv. pushed from children repo\n> 2. Is there any way to resume the cupcake branch? Can I manually add\n> the cupcake to ref/heads?\n\nI don't know why the cupcake branch would be gone, but you can  \nprobably get something from the logs:\n\n$ cat .git/logs/refs/heads/cupcake\n\nThe last line should tell you what commit you were at before it was  \ndestroyed. Then you can create the branch again.\n\n$ git checkout -b cupcake <hash in the log>\n\nHope that helps,\nNeil\n"},{"id":"101106","messageId":"488807870901182316x4b3cb1bevfbb6419aa3e4d105@mail.gmail.com","threadId":"17244","inReplyTo":"488807870901182219j763995c6y1796cf3c0a98a958@mail.gmail.com","subject":"Re: [HELP] A local branch has disappeared","fromName":"Johnny Lee","fromEmail":"johnnylee194@gmail.com","sentAt":"2009-01-19T07:16:00Z","receivedAt":"2009-01-19T07:16:00Z","isPatch":false,"sender":{"key":"johnnylee194@gmail.com","avatar":"https://gravatar.com/avatar/88def25aef325f1ca5607d6009a3f9663fcc2db6adfa93f7bd999c098710189f?d=mp&s=160"},"body":"Sorry, I forgot to reply to all in the last mail, again..\n\nHi Neil,\n\nI used \"git lost-found\" to find out the latest commits, and use git\ncheckout -b cupcake commit_hash to get my lost branch back.\n\nThanks!\n\nThough, I'm still confused about what had happened. :(\n\nRegards,\nJohnny\n\nOn Mon, Jan 19, 2009 at 2:19 PM, Johnny Lee <johnnylee194@gmail.com> wrote:\n> The log about cupcake is also gone..\n>\n> git@tomato:~/golf$ cat .git/logs/refs/heads/\n> htc_cupcake  tmo_cupcake\n>\n> And I can't get the latest hash by git log:\n> git@tomato:~/golf$ git log\n> fatal: bad default revision 'HEAD'\n>\n> Regards,\n> Johnny\n>\n> On Mon, Jan 19, 2009 at 1:37 PM, Neil Macneale <mac4@theory.org> wrote:\n>>\n>> On Jan 18, 2009, at 7:54 PM, Johnny Lee wrote:\n>>\n>>> Hi all,\n>>>\n>>> Today I found my current branch (named cupcake) has disappeared.\n>>> git@tomato:~/golf$ git branch -a\n>>>  htc_cupcake\n>>>  tmo_cupcake\n>>>  origin/HEAD\n>>>  origin/cupcake\n>>>  origin/device\n>>>\n>>> As you can see, there is no \"*\" to mark the current branch.\n>>>\n>>> But when I check the HEAD, it still pointed to the cupcake branch\n>>> git@tomato:~/golf$ cat .git/HEAD\n>>> ref: refs/heads/cupcake\n>>>\n>>> But when I check the ref/heads, the cupcake is missing\n>>> git@tomato:~/golf$ ls .git/refs/heads/\n>>> htc_cupcake  tmo_cupcake\n>>>\n>>> And the cupcake in still in the config:\n>>> git@tomato:~/golf$ cat .git/config\n>>> [core]\n>>>       repositoryformatversion = 0\n>>>       filemode = true\n>>>       bare = false\n>>>       logallrefupdates = true\n>>>       sharedRepository = 1\n>>> [remote \"origin\"]\n>>>       url = /home/rick/golfresort/device/.git\n>>>       fetch = +refs/heads/*:refs/remotes/origin/*\n>>> [branch \"cupcake\"]\n>>>       remote = origin\n>>>       merge = refs/heads/cupcake\n>>>\n>>> I'm confused:\n>>> 1. I didn't do any aggressive operations. Why the branch has\n>>> disappeared? Normally I have done these operation for this repo:\n>>>  i. pull from parent repo\n>>>  ii. cloned by children repo\n>>>  iii. pulled by children repo\n>>>  iv. pushed from children repo\n>>> 2. Is there any way to resume the cupcake branch? Can I manually add\n>>> the cupcake to ref/heads?\n>>\n>> I don't know why the cupcake branch would be gone, but you can probably get\n>> something from the logs:\n>>\n>> $ cat .git/logs/refs/heads/cupcake\n>>\n>> The last line should tell you what commit you were at before it was\n>> destroyed. Then you can create the branch again.\n>>\n>> $ git checkout -b cupcake <hash in the log>\n>>\n>> Hope that helps,\n>> Neil\n>>\n>\n>\n>\n> --\n> we all have our crosses to bear\n>\n\n\n\n-- \nwe all have our crosses to bear\n"}]}