Undo git rm -r command in github

Well, when I tried to delete remote folder on my github repository the command
that I used 100% is wrong, I am using git rm -r folder/ command ;( it also
delete the folder in local repo.

Here is the trick to undo and correct git rm command

$ git reset -- folder/
$ git checkout -- folder/

The correct git rm is ;

$ git rm -r --cached folder/

simple ;) let’s code.

Please note : This post based on my experience :D