Re: Prevent reset --hard from deleting everything if one doesn't have any commits yet

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

 



Oh yes... I did. Sigh

Regardless,

wouldn’t be nice to have a confirmation in cases like this? considering git isn’t only used by experts. It would’ve helped me A LOT, that’s for sure… and I’m 100% sure I won’t be that last person in the history of git that would suffer this.

Thank you for your quick reply.



> On Mar 1, 2019, at 2:56 AM, Johannes Sixt <j6t@xxxxxxxx> wrote:
> 
> Am 28.02.19 um 22:43 schrieb Manuel Guilamo:
>> I accidentally executed git reset —hard in a project that doesn’t
>> have any commits yet. git erased everything, everything I’ve worked
>> the past week, I believe this is not a desired behavior, considering
>> I’m not able to undo that action, because git doesn’t have any
>> history whatsoever.
> 
> I tested this, and it does not happen for me as long as I do not `git
> add` anything.
> 
> So, I assume you did `git add` your content and then you did a `git
> reset --hard`. In that case, I'm afraid Git behaved as designed and
> "doesn't have any commits" is a red herring.
> 
> -- Hannes





[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