git bad default revision 'HEAD' ã«å°ã£ãã®ã§æåä¿®æ£ãããã©ä¸å®ããæ®ããªãã£ã
VirtualBoxä¸ã®CentOSã§éçºããã¦ãã¦ãããæ¥VMãããªã¼ãºããã®ã§æ¸ã
å¼·å¶åèµ·åããããã¼ã«ã«ãªãã¸ããªãå£ããã
表é¡ã®ã¨ã©ã¼ãåºãã®ã§ã¨ãããã修復ããããå®å
¨ã«ç´ã£ã¦ãããä¸å®ã§çµå±ãªãã¸ããªãcloneãç´ããã¨ããè¨é²ã
gitã³ãã³ããè»ä¸¦ã¿å¤±æãã
$ git status fatal: bad default revision 'HEAD' $ git log fatal: bad default revision 'HEAD'
ï¼ï¼
ã©ããããã¨ãã¨æã£ã¦HEADã®ä¸èº«ãè¦ã¦ã¿ã
$ cat .git/HEAD ref: refs/heads/mybranch
ãããããç´è¿ã§ä½æ¥ãã¦ããã©ã³ãã®ã¾ã¾ã
ãã©ã³ãã®ãã¡ã¤ã«ã念ã®ãã確èª
$ find -name *mybranch* ./.git/refs/heads/mybranch ./.git/refs/remotes/origin/mybranch
ãã¡ã¤ã«ã¯ãããªã¼
ä¸èº«ã©ããªã£ã¦ãã ã
$ cat .git/refs/heads/mybranch (空) $ cat .git/refs/remotes/origin/mybranch (空)
ãã¼ä½ãç¡ã
HEADã³ãããã®SHAãåããªãããã¨ã©ã¼ã«ãªã£ã¦ãã®ããª
ãªã¢ã¼ããããã©ã³ãã®ææ°ã³ããããè¦ã¤ãã¦æåã§åãã¦ã¿ã
$ git ls-remote origin mybranch ãªã¢ã¼ãä¸ã®ææ°SHA refs/heads/mybranch $ echo -n "ãªã¢ã¼ãä¸ã®ææ°SHA" > .git/refs/heads/mybranch
ã¨ããããããã§åãããã«ã¯ãªã£ããã©...
VMããªã¼ãºã®å½±é¿ã§ä¸é¨ãã¡ã¤ã«ãå£ãã¦ããããã§ãä»ã«ãå½±é¿ãæ®ã£ã¦ããå¯è½æ§ããããã
æåã§ãã¡ã¤ã«æ¸ãæãã¦ããã®ã§å®å
¨ã«ç´ã£ã¦ããä¿è¨¼ããªããã ããªã¼
ã§ãçµå±ä¸å®ã ããã ã£ãã®ã§ãªãã¸ããªãcloneãç´ããã
ããããçµãã£ã¦ããæ°ã¥ãããã©ãããã¦ãã¡ã¤ã«ãç·¨éç¶æ
ã®ã¾ã¾æ®ã£ã¦ããã確èªãã¦éé¿ãããã°ããã£ã
æ°æã¡æªãããã¨ãå¾è
ããªãåé¤ããå¾ã ã£ã...