Re: [HELP] A local branch has disappeared

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

 




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
--
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]

  Powered by Linux