H
H
Hakhagmon2016-09-26 21:58:12
git
Hakhagmon, 2016-09-26 21:58:12

How to restore a project from .git?

Accidentally in VS Code I clicked the GIT "clear all" tab, as a result I got an empty folder, in which only the hidden .git directory (16-20mb) remained. Is there any way to restore the project?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Moseychuk, 2016-09-26
@Hakhagmon

git reflog
then git checkout the desired commit

T
theg4sh, 2016-09-27
@theg4sh

To get started, look in the basket, maybe you're lucky and you can restore everything with "one click".
If you're not lucky, you can only restore the contents of the files using:
All files will be in .git/lost-found/other/
The only thing is that you will have to somehow restore the directory tree and file names manually , because not a single tree was restored from git objects .

C
Cube, 2016-09-26
@liveunit

git clone
Or if you need to restore from a specific commit, then look at git log and do git checkout your_commit by the commit ID. I did this in the terminal, but I can’t tell you how to do it in VS Code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question