git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [HELP] A local branch has disappeared
@ 2009-01-19  3:54 Johnny Lee
  2009-01-19  5:37 ` Neil Macneale
  0 siblings, 1 reply; 3+ messages in thread
From: Johnny Lee @ 2009-01-19  3:54 UTC (permalink / raw)
  To: git

Hi all,

Today I found my current branch (named cupcake) has disappeared.
git@tomato:~/golf$ git branch -a
  htc_cupcake
  tmo_cupcake
  origin/HEAD
  origin/cupcake
  origin/device

As you can see, there is no "*" to mark the current branch.

But when I check the HEAD, it still pointed to the cupcake branch
git@tomato:~/golf$ cat .git/HEAD
ref: refs/heads/cupcake

But when I check the ref/heads, the cupcake is missing
git@tomato:~/golf$ ls .git/refs/heads/
htc_cupcake  tmo_cupcake

And the cupcake in still in the config:
git@tomato:~/golf$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        sharedRepository = 1
[remote "origin"]
        url = /home/rick/golfresort/device/.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "cupcake"]
        remote = origin
        merge = refs/heads/cupcake

I'm confused:
1. I didn't do any aggressive operations. Why the branch has
disappeared? Normally I have done these operation for this repo:
   i. pull from parent repo
   ii. cloned by children repo
   iii. pulled by children repo
   iv. pushed from children repo
2. Is there any way to resume the cupcake branch? Can I manually add
the cupcake to ref/heads?

Thanks very much for your considerations,
Johnny
-- 
we all have our crosses to bear

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [HELP] A local branch has disappeared
  2009-01-19  3:54 [HELP] A local branch has disappeared Johnny Lee
@ 2009-01-19  5:37 ` Neil Macneale
       [not found]   ` <488807870901182219j763995c6y1796cf3c0a98a958@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Macneale @ 2009-01-19  5:37 UTC (permalink / raw)
  To: Johnny Lee; +Cc: git


On Jan 18, 2009, at 7:54 PM, Johnny Lee wrote:

> Hi all,
>
> Today I found my current branch (named cupcake) has disappeared.
> git@tomato:~/golf$ git branch -a
>  htc_cupcake
>  tmo_cupcake
>  origin/HEAD
>  origin/cupcake
>  origin/device
>
> As you can see, there is no "*" to mark the current branch.
>
> But when I check the HEAD, it still pointed to the cupcake branch
> git@tomato:~/golf$ cat .git/HEAD
> ref: refs/heads/cupcake
>
> But when I check the ref/heads, the cupcake is missing
> git@tomato:~/golf$ ls .git/refs/heads/
> htc_cupcake  tmo_cupcake
>
> And the cupcake in still in the config:
> git@tomato:~/golf$ cat .git/config
> [core]
>        repositoryformatversion = 0
>        filemode = true
>        bare = false
>        logallrefupdates = true
>        sharedRepository = 1
> [remote "origin"]
>        url = /home/rick/golfresort/device/.git
>        fetch = +refs/heads/*:refs/remotes/origin/*
> [branch "cupcake"]
>        remote = origin
>        merge = refs/heads/cupcake
>
> I'm confused:
> 1. I didn't do any aggressive operations. Why the branch has
> disappeared? Normally I have done these operation for this repo:
>   i. pull from parent repo
>   ii. cloned by children repo
>   iii. pulled by children repo
>   iv. pushed from children repo
> 2. Is there any way to resume the cupcake branch? Can I manually add
> the cupcake to ref/heads?

I don't know why the cupcake branch would be gone, but you can  
probably get something from the logs:

$ cat .git/logs/refs/heads/cupcake

The last line should tell you what commit you were at before it was  
destroyed. Then you can create the branch again.

$ git checkout -b cupcake <hash in the log>

Hope that helps,
Neil

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [HELP] A local branch has disappeared
       [not found]   ` <488807870901182219j763995c6y1796cf3c0a98a958@mail.gmail.com>
@ 2009-01-19  7:16     ` Johnny Lee
  0 siblings, 0 replies; 3+ messages in thread
From: Johnny Lee @ 2009-01-19  7:16 UTC (permalink / raw)
  To: Neil Macneale; +Cc: git

Sorry, I forgot to reply to all in the last mail, again..

Hi Neil,

I used "git lost-found" to find out the latest commits, and use git
checkout -b cupcake commit_hash to get my lost branch back.

Thanks!

Though, I'm still confused about what had happened. :(

Regards,
Johnny

On Mon, Jan 19, 2009 at 2:19 PM, Johnny Lee <johnnylee194@gmail.com> wrote:
> The log about cupcake is also gone..
>
> git@tomato:~/golf$ cat .git/logs/refs/heads/
> htc_cupcake  tmo_cupcake
>
> And I can't get the latest hash by git log:
> git@tomato:~/golf$ git log
> fatal: bad default revision 'HEAD'
>
> Regards,
> Johnny
>
> On Mon, Jan 19, 2009 at 1:37 PM, Neil Macneale <mac4@theory.org> wrote:
>>
>> On Jan 18, 2009, at 7:54 PM, Johnny Lee wrote:
>>
>>> Hi all,
>>>
>>> Today I found my current branch (named cupcake) has disappeared.
>>> git@tomato:~/golf$ git branch -a
>>>  htc_cupcake
>>>  tmo_cupcake
>>>  origin/HEAD
>>>  origin/cupcake
>>>  origin/device
>>>
>>> As you can see, there is no "*" to mark the current branch.
>>>
>>> But when I check the HEAD, it still pointed to the cupcake branch
>>> git@tomato:~/golf$ cat .git/HEAD
>>> ref: refs/heads/cupcake
>>>
>>> But when I check the ref/heads, the cupcake is missing
>>> git@tomato:~/golf$ ls .git/refs/heads/
>>> htc_cupcake  tmo_cupcake
>>>
>>> And the cupcake in still in the config:
>>> git@tomato:~/golf$ cat .git/config
>>> [core]
>>>       repositoryformatversion = 0
>>>       filemode = true
>>>       bare = false
>>>       logallrefupdates = true
>>>       sharedRepository = 1
>>> [remote "origin"]
>>>       url = /home/rick/golfresort/device/.git
>>>       fetch = +refs/heads/*:refs/remotes/origin/*
>>> [branch "cupcake"]
>>>       remote = origin
>>>       merge = refs/heads/cupcake
>>>
>>> I'm confused:
>>> 1. I didn't do any aggressive operations. Why the branch has
>>> disappeared? Normally I have done these operation for this repo:
>>>  i. pull from parent repo
>>>  ii. cloned by children repo
>>>  iii. pulled by children repo
>>>  iv. pushed from children repo
>>> 2. Is there any way to resume the cupcake branch? Can I manually add
>>> the cupcake to ref/heads?
>>
>> I don't know why the cupcake branch would be gone, but you can probably get
>> something from the logs:
>>
>> $ cat .git/logs/refs/heads/cupcake
>>
>> The last line should tell you what commit you were at before it was
>> destroyed. Then you can create the branch again.
>>
>> $ git checkout -b cupcake <hash in the log>
>>
>> Hope that helps,
>> Neil
>>
>
>
>
> --
> we all have our crosses to bear
>



-- 
we all have our crosses to bear

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-19  7:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19  3:54 [HELP] A local branch has disappeared Johnny Lee
2009-01-19  5:37 ` Neil Macneale
     [not found]   ` <488807870901182219j763995c6y1796cf3c0a98a958@mail.gmail.com>
2009-01-19  7:16     ` Johnny Lee

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).