Answer the question
In order to leave comments, you need to log in
How to take a step back? Accidentally made in the project folder rm -rf *
Overworked and the head does not understand at all. Accidentally executed rm -rf * in the console and deleted the week's work. Git is there but hasn't been committed for a long time. git st tells you which files were deleted, but I don't know how to get back all the deleted files. How can you step back and bring back everything that was deleted? Community, please help, otherwise it turns out very insulting.
Answer the question
In order to leave comments, you need to log in
Either they told you wrong at the LOR or you misunderstood.
git checkout - MyFile will roll back a specific file to the state of the last commit. Miracles do not happen and the git does not know what exactly you are too lazy to commit.
As they rightly said - either abandon the last commit and write again, from memory, or look for ways to restore data using the system tool or recovery utilities. But git has nothing to do with it.
Eeee, then you don’t particularly torment the computer, so that you don’t accidentally write down anything superfluous from the top. If possible, then make a dd copy of the disk you are working on to a new medium. Then mount this image in read-only and there you already need to look for what programs you can restore the files you need.
You can then open the copy in any editor that can adequately read large files and search for the files you need. For example, if these are PHP files, then look for the occurrence of <?php (or whatever you have there) and restore them.
Try
git reset HEAD
if it doesn't work, then try
git reset --hard HEAD
Files can be restored (google). The main thing is not to write anything from above.
And you don’t use an IDE, they have a local history, everything goes perfectly from there, it saved me a couple of times from accidental deletion.
git checkout .
rolls back the state of the given folder ( .
) to the last commit.
Just yesterday I restored the file with the Scalpel program (http://habrahabr.ru/post/55465/). I managed to restore a file 2 months ago, which I even forgot that I had deleted, I had to urgently restore it - the utility helped
You can write a script that will go through the list and get them one by one.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question