0

I just started learning GitHub. During the course of implementing what I learnt, I mistakenly added and committed some files to a sub branch in a remote repo. I tried to undo it but I couldn't, out of frustration, I deleted the sub branch from git hub, thinking the files in it will return to my folder in vscode, but now the files are missing in vscode and I can't seem to find it anywhere.

How do I restore the files back to my folder in vscode?

James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0
  1. If the files in your sub branch (that you deleted) were already committed to GitHub, you can open your repository, click on Code. On this tab you will see a blue rectangle displaying your GitHub username and last commit message, to the right of the tab, click on the clock icon showing all your previous commits.

You will be able to check all your commits to the repository, and subsequently be able to retrieve the deleted files. Once retrieved just do a final commit, so the project files on your local computer get updated too, i.e. Vscode.

tl;dr : retrieve your deleted files by checking past commits on GitHub.

Reference link for help: In GitHub, is there a way to see all (recent) commits on all branches?

  1. You can also check the VS code folder in the Recycle Bin on your computer, and restore the files from there.
No_Name
  • 155
  • 2
  • 14
  • I tried your first answer but unfortunately, I didn't push before deleting. I clicked on the multiplication sign at the left side of the file in open editor in vs code, it brought a notification and I clicked save, this happened just before it disappeared. This could be the reason? – Oluwadara Afolabi Aug 28 '22 at 20:27
  • From what I am understanding, you saved the files before deleting, so it should be in your Recycle Bin in your local machine. You can still retrieve files from there. – No_Name Aug 30 '22 at 15:55