Delete some files from github web interface. How to resore them?

Dear experst.
Recently I deleted some files from my profile Java projects via web interface.
github-file-deleted-question
I couldn’t find any way to restore them back?
I would be apprecciate for any advice.

Hi @GrigoriiAndreev

You can revert the commit where you deleted the file in the commit details page.

Cheers,

Sarah

Hi, snim2. Thanks for your replay, but I cannot find any Revert button on the commit detail page.

On the right of the Browse files button, hopefully there is another button marked Options and the revert option will be on the drop-down there.

If you don’t have that button, it looks like you are on your default branch (master) which is probably protected. You will need to go to SettingsRepositoryProtected branches to change that. If you do so, make sure you add the protection back in.

Really, it would be better to work in merge requests on feature branches, so that you don’t ever have to un-protect master or main.

Sorry, there really no other button


And I also cannot find Protected Branches:

Yes, I just beginner of the system.

Ah, I see you are using GitHub, and this forum is for users of GitLab. You probably want to try the GitHub forum. Best of luck!

Anyway, thanks for help!

Hi there, I have a repo on GitLab about dragon city mod which is an android game mod that I am developing for a couple of months. I have accidentally committed too many wrong codes in my repo. How far I can go to reverse my commits?
Thanks,
Kevin

@kevinbaconten you could either run git revert on the command line, or use the GitLab user interface to do the same thing.