How do I remove files from Git?


#1

Somehow I inadvertently “copied” a slew of files into the Git staging area (see attached). How do I remove them? It’s slowed the app down to a crawl and they are files unrelated to my project.


#2

Are you sure that’s what happened? You haven’t shared your operating system, but your issue resembles one that has come up multiple times on these forums where MacOS users happen to have a .git folder in their home directory, and that makes Atom try to track every file they have. If you are indeed using Mac, the command rm -r ~/.git should solve the problem.


#3

Thanks for the heads up on the command and the home directory issue on MacOS. Is there a better place to locate a projects folder to avoid this?

I ended up removing the offending directory so problem solved.


#4

Did you make your home directory a git repo on purpose to keep all of your projects? Git repos work best when there’s one project per repository, but at the very least, any repo should be in a folder with a minimal number of subdirectories not in the repo (so that it’s easy to manage which ones to ignore with .gitignore).

I feel like the most intuitive way is to have a github/ that contains individual repo directories.


#5

Did you make your home directory a git repo on purpose to keep all of your projects? Git repos work best when there’s one project per repository, but at the very least, any repo should be in a folder with a minimal number of subdirectories not in the repo

As a neophyte coder (just getting started on Codecademy), I’m just following their instructions which was to create a folder called Projects in my home folder and then add each individual project folder to the folder called Projects (see attached). When I do git init, I do it within the individual project folder (e.g broadway) but perhaps I’m not following the steps correctly or forgetting to do git init. If there is a better set up, I’m all ears.