Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
19.1k views
in GitHub by 16 16 22
Yesterday, I have deleted a file on the GitHub website, and now I want to recover and restore this deleted file from the GitHub website without using the git commands, Is it possible?

I don't know where can I find the files that I have deleted! Is there trash or recycle bin on the GitHub site?  Where I can find the history of all deleted files from the GitHub website and how I can restore them back without using the command line?

Thanks

1 Answer

1 like 0 dislike
by 163 204 403
selected by
 
Best answer

Restore deleted files in GitHub WebSite

As a short answer, you can't restore deleted files and revert changes in the commits at the GitHub website, instead, you should use the GitHub desktop.

Where can I find the files that I have deleted on the GitHub website?

There is no such Recycle bin or Trash for the deleted files, instead, you should check the Commits to track the history of your updates in the tp of your GitHub repository as shown below.

check commits in GitHub web site

After clicking on Commits, you can find all changes that you have done like adding a new file, update a file, delete a file ...etc, and the GitHub commits are categorized by Date and order by newer to older as you can see.

track the history in GitHub

Note: On the GitHub website, you can easily Revert a Pull Request. however, you can't perform "Revert changes in commits", and you should use the GitHub desktop as I have earlier mentioned.

How to revert commits in GitHub Desktop?

  1. Download and install the GitHub desktop from https://desktop.github.com/.
  2. Connect to your GitHub account.
  3. From the "File" menu, click on "Clone Repository ".
    clone repository in GitHub
  4. Select the Repository that you would like to clone from github.com and specify where you need to save it locally.
    clone repository from GitHub.com
  5. Now, click on "Fetch Origin" to get all files and commits for this Repository.
    fetch origin in github
  6. Click on the "History" tab to check all commits in GitHub Desktop.
    check history in GitHub desktop
  7. Right-click on the commit that you would like to revert > Select "Revert Changes in Commit".
    revert changes in commit github
  8. Now, click on "Push Origin" to apply the revert action.
    push origin in github
  9. Go back to check the deleted file on the GitHub website, you will note that the deleted file has been recovered successfully as shown below:
    revert deleted file in GitHub desktop

Note: To revert multiple commits, it's strongly recommended to revert changes in order from newest to oldest to avoid merge conflicts.


See Also

If you don’t ask, the answer is always NO!
...