Re: fatal: ambiguous argument 'HEAD^': unknown revision or path not in the working tree.

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

 



On Thu, Oct 28, 2010 at 3:09 PM, Todd Wells <ttopwells@xxxxxxxxx> wrote:
> I was using GitX to prepare a commit. Something happened -- I don't
> know what --  and suddenly my branch only had a single commit
> in it that appears to contain all  the files in my tree. So I went to the
> command line and did this:
>
> $ git reset --soft HEAD^
> fatal: ambiguous argument 'HEAD^': unknown revision or path not
> in the working tree.
>
> When I do 'git log' in this branch, there's only one commit. Now, I
> had many commits in this branch a few minutes ago. I really,
> really, don't want to lose this.
>
> What steps should I take to attempt to recover?

You could try:

git log -g

which will show you the reflog, a log of recent tip commits of HEAD.
You could also try to see other local branches and their reflog.

If all this fails you can:

git fsck --unreachable

that will output all the unreachable commits/objects, those not in
your branches or reflogs.

Once you have the correct commit you can reset the HEAD to this commit:

git reset HEAD

(or with --hard as necessary).

HTH,
Santi
--
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]