Seems that you opened vscode on the user directory, and one way to fix that is opening only your project folder. On the top menu you can try clicking on âFileâ -> âOpen FolderâŚâ and select your project folder.
hi i attempted this but it did not work. the moment i open vs code, it will show the large number of files
âThe git repository at âc:\Users\Yazâ has too many active changes, only a subset of Git features will be enabled. Would you like to add ânode_modulesâ to .gitignore?â
yes, i dont want my main user directory to be the root. how can i change this? i accidentally created a git folder in my main directory
if i just remove the git from the main user directory, will that do it? or is that wrong?
(if i remove the git from the main directory, what will be the new master?)
Yes, just delete the .git folder, itâs not supposed to be there so get rid of it (at the minute you are trying to make git track every file in your root directory). Then reinitialise in the correct directory (and make sure you add node_modules to the .gitignore file).
If you delete it, you wonât have anything tracked, nothing will be âmasterâ, this is what you want at the minute. The . git folder is just where the record of whatâs being tracked lives, and atm it isnât tracking anything you want, so deleting it is fine. If you initialise a git repo in the wrong folder, always just delete the .git folder and start again in the correct place
thats great - yes i deleted it and now the large number of untracked files has disappeared.
And so, i dont need to have anything for a master file. Currently, i âgit initâ in the folder i want, then git add . , then git commit, then push the repo without assigning any folder as a master.
Yes, but if youâve already started making changes and commits, wonât you lose that history?
For one project I accidentally initialized the git repo one directory too high and started making commits without realizing. It was the only thing in that top directory (/my-project/my-REAL-project) so it wasnât really a problem. But it was annoying.
I discovered that you can actually move the .git folder and not lose any of your history. The first commit you make will be a big one of all the ârenamedâ files.
mv .git my-REAL-project
cd my-REAL-project
git add .
git commit
The âmasterâ is the main/default branch of your project. Itâs created when you initialized git with git init. It just means that those versions of the files are the default branch of your project. If you want to make major or experimental changes, you can create a new branch. After those changes are complete you can merge that branch back into master. Branching is kind of the point of git, so itâs good to learn eventually.
Yes, in certain circumstances you may want to do this, but ideally you donât, you just delete. The issue is is that if you have committed changes, theres a very high likelihood that the git history is polluted by dint of making commits in a completely different directory. ie if itâs the root, then anything personal you do on your computer has the potential to be marked as a change, and itâs then ridiculously easy to accidentally commit completely unrelated stuff (often vast amounts of unrelated stuff if youâre not paying attention). And if that is the case, it often becomes very difficult to cherry pick out those erroneous commits.
As it is, yes, it may be fine, but thatâs context sensitive, and nuking the entire thing is generally far, far easier and the correct thing to do.