On Tue, 16 Sep 2014 05:57:30 -0700 (PDT)
"muhammad.iqbal dwi.cahyo" <razelux...@gmail.com> wrote:

> Hello everyone, I'm relatively new to git :) git awesome, lightweight
> and compatible with windows environment :) I start developing my
> project under git dvcs, unfotunately I had this problem a while ago
> T___T
> 
> 
> I already made a project there, add, commit, push. Unfotunately, I've
> got power surgery :'(

That's "surge"; "surgery" is when someone undergoes an invasive
operation done by medical personnel :-)

> When I've tried restart my PC, I cd back to my project folder, but
> suddenly it looks like these:
> 
> UserName@PC /c/xampp/htdocs/website
> 
> before 
> UserName@PC /c/xampp/htdocs/website (master)

That means Git Bash failed to parse the HEAD reference.
That's because it's seriously hosed (see below).

> I tried "git init" and this showed up:
> 
> Reinitialized existing Git repository in c:/xampp/htdocs/website/.git/
> 
> but, nothing happen to my repo T__T

> it still looks like these: 
> UserName@PC /c/xampp/htdocs/website
> 
> Thank you very much, your guidance please t(^_^)
> 
> *EDIT*: I did git stash save before power surgery & this files comes
> up: 

The repo is seriously botched.  The HEAD ref contains 40 bytes
with the value 0 while it normally contains some ASCII text (something
like "ref: refs/heads/master" without the quotes in your case).
The index has a binary format so that's sort of OK it's not
human-readable but its first several hundred bytes definitely are not 0
normally as well.

What do do now.

The first thing is to back the whole project directory
(/c/xampp/htdocs/website) which means to *copy* it in its entirety
to some other filesystem, known to be in a good state.
The next step is to run

  chkdsk /x /f c:

in your console window (cmd.exe) (supposedly you have to run it as
an administrator), answer yes when it asks you whether it's OK to
schedule disk check at the next reboot, then reboot and make the disk
checker do its work.  If it'll tell you it have found errors, repeat
the check after the box boots.

Once you have your file system in a consistent state, return to your
hosed repository and try this:

1. Make sensible HEAD ref:

    echo "ref: refs/heads/master" >.git/HEAD

2. Delete the botched index file:

    rm .git/index

3. Re-create the index:

    git read-tree HEAD

4. Run Git's object store checker:

    git fsck --lost-found

The last step should attempt to repair whatever inconsistencies it
finds or at least report them.  It will also create entries for
entities it considers being lost under the .git/lost-found
directory.

If this tools runs and does not throw up in despair, try to inspect
the state of the repository (`git log`, `gitk` etc).

If you'll not be satisfied with the result, come back with more
information so we could think further.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to