Reputation: 59
Every time I use the git init
command for my project in VS Code, it suggests 5k+ changes in source control.
Do I need to reinstall something? Nothing I have searched regarding this problem seems to be working. How do I get rid of this problem?
Upvotes: 5
Views: 9606
Reputation: 131
Had the exact same problem.
In vscode Right click on "SOURCE CONTROL" at the top of open source control panel, then make sure "Source Control" is selected.
Open the drop down "SOURCE CONTROL REPOSITORIES" next to the top of the source control panel and right click on the repo which is incorrectly set and select "Close Repository".
Here is a visual of the answer
Upvotes: 0
Reputation: 409
If you are using Mac,
Make sure you go to the Home Folder and delete everything from there.
Mine has fixed this way
Upvotes: 0
Reputation: 1
In this case find a folder called .git on C:\Users\xxxxx >>> here check that there's no hidden folders, then just delete that folder, all 5k changes will disappear.
Upvotes: 0
Reputation: 1
Its because git is tracking for all the files even which are present in node_modules directory. You have to create a .gitignore file and add node_modules/ inside it to tell git not to track them as they are third party code.
Upvotes: 0
Reputation: 121
I had the same issue and turns out I was tracking my home directory without knowing, probably by accident. I just deleted the .git folder in home directory and the problem was solved.
$ rm -rf .git
Upvotes: 10
Reputation: 784
If you are using nodejs/react/meteor project, you must know that it will create .node_module/local folder for you under which all modules are saved.
Then you should
create .gitignore file
file under your project folder.
add below line to it:
If you have node/react project and you can see untracked files from node_module folder
node_modules
If you have meteor project and you can see untracked files from local folder of .meteor folder.
local
Upvotes: 1
Reputation: 21
You have to create a .gitignore
file, and put it in your root folder.
The purpose of .gitignore
files is to ensure that certain files not tracked by GIT remain untracked.
I use Visual Studio Code, I'm sure it's all the same. I created a new file named .gitignore in my root folder.
This is an example of what I put to ignore node_modules
:
My source: https://coursework.vschool.io/create-a-gitignore/
Upvotes: 2
Reputation: 6120
As I mentioned in my comment you may have initialized your git in a folder containing many other files. @vonc has already explained the issue. Try the following:
Close visual studio code On the command prompt (windows) or terminal (osx) go to the folder where your project is i.e if your project folder is
c:\users\someuser\project\racecar_project
Make sure you are inside the folder racecar_project
Initialize your git by issuing git init
.
Next you may want to add the files to your git repo by:
git add --all
Now open visual studio code and go to your folder. Open gitlense if that is one of the plugins you are using and change a few files, the change should only show the files you have changed.
Upvotes: 2
Reputation: 1324606
It should be 5K+ new files to add, if you truly initialize a new repository in a non-empty folder.
In that case, you need to add a .gitignore
file at the root folder of your initialized repo, and add patterns to ignore what you don't need.
That is assuming that root folder is the one for your existing project (and not /
or $HOME
, which would include way too many file, unrelated to your project)
Upvotes: 0