How to recover deleted files after major changes with git?

Good day!
Was made a fork of the git repository in the local copy of the fork was removed quite a large number of files, and then nausena to the remote fork n number of commits. Is it possible to recover deleted files keeping the changes made? To vanish again a master repository from which you made the fork to a local repo does not work, probably because of changes in the master repository was not and git thinks everything is up to date.
June 5th 19 at 21:34
2 answers
June 5th 19 at 21:36
Solution
Doing git reset HEAD~1, where 1 is the number of commits where files have been deleted. Then carefully remove deleted file from staging area and posite all the changes in place.
This is a bad option if developers of more than 1. The scenario above commits with deleted files already uploaded on the remote repository, and therefore can be downloaded by other users.
Your proposed way nothing like rebase and then push to have forced. For such maneuvers you health exactly like this... ;) - lulu75 commented on June 5th 19 at 21:39
June 5th 19 at 21:38
First find the commit where the file still is (in your case you can use upstream/master). Then:
1. Visualize a list of changed files (grep'Ohm filtered only the remote)
2. Restore the necessary files from the commit
Next, make a new commit, posite to the repository, etc.
git diff --name-status upstream/master | grep ^D
git checkout upstream/master <path to the deleted file></path>

Find more questions by tags GitGitHub