Reputation: 8378
I accidentally deleted all of my files whilst trying to push them to GitHub in what would have been the first commit (I have no idea how I managed this).
I have no local backup and no remote backup but in my GitLens VSCode extension the files are still there and viewable:
How can I revert my current file tree back to what's being shown in GitLens?
Upvotes: 0
Views: 131
Reputation: 8378
I managed to recover all the files aside from vendor and node_modules, ran npm install
and composer install
and this fixed that issue. Still not sure how this happened though. Will have to brush up on my git skills methinks.
Upvotes: 0
Reputation: 33
Since you can see in gitlens, it means your files are present in previous commit.
You can do checkout to get it back as @mr.mams mentioned. You can also undo your commit, check How do I undo the most recent local commits in Git?
To merge two commits you need to squash your commits. Check Squash my last X commits together using Git
Upvotes: 2