Deletes files from local git repository and the remote repository. Use git clean to delete unstaged/untracked files.

[delete specific file]

git rm <path-filename>

[delete multi files with wildcard]

git rm <rule>*<rule>

[example: git rm mydire/* all files in dir]

[example: git rm src/main/java/test/*.java all files of type java in specified dir]

[to recover a deleted file where delete has been commited first get SHA-1(Commit Id) of commit that deleted it]

git rev-list HEAD -n 1 -- <path-filename>

[Example: git rev-list HEAD -n 1 -- src/main/java/BusinessWorker.java]

[restore file]

git checkout <commid-id>^ <path-filename>

[Example: git checkout 464cb30e152b07f702e90f16f4cf6c3a5209e95b^ src/main/java/BusinessWorker.java]

https://buildvirtual.net/how-to-remove-or-delete-a-file-from-git/#:~:text=To%20delete%20a%20file%20from%20Git%2C%20use%20the%20git%20rm,checkout%20command%20to%20restore%20it.

https://rewind.com/blog/recovering-deleted-files-in-github/#:~:text=If%20you%20have%20deleted%20the,file%20from%20the%20previous%20commit.