Or just branch and commit before you use it. `git reset` is really the only git command that can lose data, and it will only lose uncommitted data. The lesson: commit early, commit often. You can always undo a commit, edit it or just abandon it, you can't undo a reset on uncommitted data.
On Thu, Sep 2, 2010 at 11:51 AM, Ben Greear <[email protected]> wrote: > On 09/02/2010 03:15 AM, paulatz wrote: > >> Hi all, >> I seriously need help with git, I hope you can help. >> >> I'm working on a quite big open-source software projects which is >> managed with svn. Because I'm developing an extensive separate branch >> (a task that takes about one year or more), and for logistic reasons, >> I've got my copy which I keep up to date with the svn and manage >> locally with git. >> >> I don't use many fancy git features: I initialized the repository, >> only adding the source file of a few directories (the others I'm not >> going to touch) and commit my edits regularly to keep track of what >> I'm changing and being able to revert (reset, in git talk) them if >> necessary. >> >> Well, a few hours ago I needed to reset the source code *in a specific >> subdirectory* to a previous state in order to check when a problem >> appeared, so I typed >> git reset --hard -q b793...(the revision number) >> ok, the code has been reverted, but all the files in the parent >> directory, which I (think I) had never added to the repository, and >> for sure I had never modified, have been destroyed, erase, canceled >> and wiped out. >> >> Is there any way to recover them? Where have they gone? I've been >> reading git documentation for hours now, but I cannot find any mention >> of similar issues. >> >> thank you in advance >> >> > I think they are gone forever. git reset can be very nasty, and it acts > on the entire repository, not just a sub-directory. I'd always make sure > to make a full backup of the entire repository before playing around with > 'git reset' until you understand it better. > > Thanks, > Ben > > > -- > Ben Greear <[email protected]> > Candela Technologies Inc http://www.candelatech.com > > > -- > You received this message because you are subscribed to the Google Groups > "GitHub" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<github%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/github?hl=en. > > -- You received this message because you are subscribed to the Google Groups "GitHub" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/github?hl=en.
