Issue
I used git rm -r virtualenv to remove my virtual environment from git, not realizing it would delete it locally too. I do still have the this virtenv folder still in my remote Github repository. What commands do I need to run to get it back into my local directory? The project structure was an outer Flask directory for backend files, and inner React directory for frontend, so I have two virtualenv folders to get back.
Solution
1- Take everything from git. Git fetch basically downloads everything from the git repo but does not merge anything into your local branch. It just makes sure that you have everything on your computer
git fetch --all
2 - Check out the file or directory you wish. This takes the folder then into your local branch
git checkout origin/<branch_name> <path_to_directory>
3 - Then you can just commit it and push. In your case, it is probably not required but if you were on another branch. You would need these steps. (For example: when you take the original version of a file from master and want to push it to your local branch
git commit -m "..."
git push origin <branch_name>
Answered By - Berkay Berabi Answer Checked By - Marie Seifert (WPSolving Admin)