VS Code - The git repository has too many active changes, only a subset of Git features will be enabled
Asked Answered
C

23

32

I am setting up VS Code to work on an existing Salesforce project saved in BitBucket.

I cloned the repository down to my device and now when I open VS Code I get the message

The git repository at 'C:\Users[my repository directory]' has too many active changes, only a subset of Git features will be enabled.

When I go to Git in the left hand menu, it says I have 5000 staged changes and it appears to think those changes are that I deleted the files even though I can see them when I go to the file path myself.

Suggestions?

Visual Studio Code details:

  • Version: 1.42.0 (user setup)
  • Commit: ae08d5460b5a45169385ff3fd44208f431992451
  • Date: 2020-02-06T10:51:34.058Z
  • Electron: 6.1.6
  • Chrome: 76.0.3809.146
  • Node.js: 12.4.0
  • V8: 7.6.303.31-electron.0
  • OS: Windows_NT x64 10.0.18362

Message & Git output

Confiscable answered 11/2, 2020 at 0:38 Comment(5)
Can you clarify the folder where this repo is? I understand that you have removed personally identifying information with "[my repository directory]" but I think more details will help us help you. Like for example, you left out the \ after Users. Is your repository in C:\Users\myrepo? Or is it in C:\Users\MyUserName\myrepo or is it in C:\Users\MyUserName\Documents\myrepo?Devastate
this could be an EOF issue. what OS are you using?Sham
try this command git config core.autocrlf trueSham
Sorry for the missing backslash----the full path it references is C:\Users\RachelBeach\Documents\Salesforce\VS Code\hyp_re-vs-code-backupConfiscable
AliReza, interesting idea...I'm using Windows 10 and it is highly likely that the person who created the repository was using a Mac. I tried running that commend in the terminal window in VS Code and then restarted VS Code. I got the same problem but is there more I should be doing?Confiscable
A
20

Check with git ls-files --eol (Git 2.8+) if this is an eol issue.

If yes, then:

  • type git config --global core.autocrlf false
  • re-clone your repository
  • check if the issue persists on VSCode
Amabil answered 11/2, 2020 at 5:35 Comment(3)
So git ls-files and git ls-files --eol both have no output (see screenshot). You did say it was with Git 2.8+ and I have 2.25 but the website says that's the most up to date build and was updated three weeks ago git-scm.com/download/win. Would you recommend still re-cloning?Confiscable
@Confiscable Regarding eol conversion, see https://mcmap.net/q/11292/-how-line-ending-conversions-work-with-git-core-autocrlf-between-different-operating-systems (and the answer below that, which is mine, about the better practice of .gitattributes core.eol directives)Amabil
@Confiscable "If so, which file would this have been?" Potentially binary files. The drawbacks of core.autocrlf is that it converts *everything.Amabil
E
29

A different explanation, not listed yet, might help you if two things are true

  1. you have a .git folder higher up in the folder hierarchy that you are not aware of
  2. your project that you are working on in VS code does not have an own .git folder

the 2. point is easy to verify.

Regarding the 1. point, you need to write the following in your terminal while being in the directory of your affected project:

git rev-parse --show-toplevel

This command searches a .git folder that is higher up in the directory tree of your files and it will return the location of the first encountered git repository. This means you either will receive a fatal not found or a path.

Go to this directory and delete the .git folder (after checking the log to see that you won't loose information) and then create a .git folder in your project directory.

Ewall answered 26/10, 2021 at 10:48 Comment(1)
I accidentally had a .git folder in my home directory that caused this. I deleted it and now things work as normal.Trough
A
20

Check with git ls-files --eol (Git 2.8+) if this is an eol issue.

If yes, then:

  • type git config --global core.autocrlf false
  • re-clone your repository
  • check if the issue persists on VSCode
Amabil answered 11/2, 2020 at 5:35 Comment(3)
So git ls-files and git ls-files --eol both have no output (see screenshot). You did say it was with Git 2.8+ and I have 2.25 but the website says that's the most up to date build and was updated three weeks ago git-scm.com/download/win. Would you recommend still re-cloning?Confiscable
@Confiscable Regarding eol conversion, see https://mcmap.net/q/11292/-how-line-ending-conversions-work-with-git-core-autocrlf-between-different-operating-systems (and the answer below that, which is mine, about the better practice of .gitattributes core.eol directives)Amabil
@Confiscable "If so, which file would this have been?" Potentially binary files. The drawbacks of core.autocrlf is that it converts *everything.Amabil
C
13

Here is a summary of possible causes, from prior answers to this post:

  • Missing .gitignore file

  • Missing entries in .gitignore for files or folders that should not be committed to git.

  • You just made a lot of manual changes or you used an external tool which did that. VsCode needs some time to process the changes.

  • Your .git folder is higher up in the folder hierarchy than it should be.

  • You need to open just the project you want to work on instead of a parent project.

  • Try the terminal or GUI to open the project instead of dragging a project folder into VsCode.

  • Check that you didn't do your "git init" in the wrong place, especially if in a parent folder of the project.

  • An eol issue. Type: "git ls-files --eol" (Git 2.8+). If yes, then:

type: git config --global core.autocrlf false
re-clone your repository
check if the issue persists on VSCode
Coady answered 29/1, 2022 at 21:4 Comment(1)
I made a .gitignore file and mentioned my packages folder in it before doing the "git init", and it stopped giving me that warningArris
B
12

Had the exact same problem.

  1. In vscode Right click on "SOURCE CONTROL" at the top of open source control panel, then make sure "Source Control" is selected.

  2. 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

Burks answered 4/2, 2022 at 23:48 Comment(0)
A
9

My resolution was fortunately straightforward. I accidentally deleted .gitignore when copying a project and once I restored that file the problem was resolved.

Amaliaamalie answered 14/12, 2020 at 16:40 Comment(2)
This is somewhat similar to my case. I have four WordPress plugin files that I work with. I never had a .gitignore file at all, but when I added one to the root of the project the problem went away.Post
Having node_modules with many dependency files/folders inside, vscode can't handle the changes inside the directory. Basically, adding node_modules to .gitignore resolves the issue.Coorg
P
4

So what happened in my case , I opened GitBash and typed git init to initialize a repo but , what actually happened was my C drive whole folder was made a repo and that is why it was showing 10000 changes detected to revert the changes or discard , Remove the directory :

  1. Open git bash
  2. Type rm -rf .git on it and press enter
  3. This command will remove that repo no files will be deleted its safe to use
  4. create a new repo to push
Positronium answered 27/1, 2022 at 6:53 Comment(0)
R
3

The problem is that vs code needs some time if you do a huge amount of change. This generally happens when you delete or add files manually to the repository. First of all,

  • Don't sync before commit.
  • If you see a clock icon on "the source control tab", just wait. Because you can not commit before that icon gone.
  • If you try to sync then it goes into a loop.

Literally, the solution is waiting until to see the number of changes on the source control tab. Then commit and sync.

Ripieno answered 10/4, 2020 at 19:26 Comment(2)
This should be the highest most voted answer. when you delete thousands of files and re-add them, it will list the deletions first, and then clock is showing on menu, and that is the only indication that it is actually working. Give it time, even an hour, and that will change, and it will see the modifications as wellMorville
Also, if you have forgot to give it a commit message, make sure it has not opened a window, waiting for you to write a commit comment, save and close the window to continueMorville
C
2

OK it looks like it was something to do with the line breaks!

I deleted the local files, updated the global configuration settings to set autocrlf to false (and I ended up having to change another global config setting core.longpaths to true as well). Then I re-cloned and it's all working now!

My assumption is that the autocrlf setting takes the remote files and edits all the line feeds to make them match the way your OS does line feeds.

So since git thought I deleted all my files (and ls-files returned nothing), that maybe mean that there was some file that was altered in this way during the clone so git didn't know where my files were.

Confiscable answered 11/2, 2020 at 20:58 Comment(0)
Y
0

I my case, the issue was solved by changing the way I open VS Code.

When I dragged the project folder into a VS Code window just opened, then the "too many active changes" message appeared, perhaps VS Code interpreted the current project as the previous one charged.

Instead, when I go to the project folder and put "open with" and select VS Code the problem goes away.

Yesteryear answered 16/12, 2020 at 14:34 Comment(0)
A
0

I was running an external tool that made a lot of changes quickly while I had the project open in CODE and this happened. The only thing that fixed it was re-cloning the entire repository to a new directory.

Anking answered 25/2, 2021 at 21:6 Comment(0)
E
0

I had the same issue and found a thread with a very straight-forward solution.

The problem was that I cloned a repository and did not have a .gitignore file.

  • I simply added the .gitignore file to the root folder,
  • wrote node_modules into it,
  • saved, and the problem was gone.

Here is the link to the thread: https://forum.freecodecamp.org/t/vs-code-has-5000-files-that-need-to-be-commit/250686/5

Other projects I worked on also have this line in their .gitignore file, so I guess this is a standard. Also, it does make sense, since as developers we do not want to up-and download all node modules to git but use the package.json file to share the information on which modules we need to work on the particular project.

El answered 26/3, 2021 at 13:37 Comment(0)
F
0

The problem has occurred many times for me. The solution is to make sure that you open your project correctly. For example i have a map called backend and into that map i have another map called project(here is my cloned project). When i open vscode i open the map "project" directly instead of "backend".

French answered 6/6, 2021 at 10:48 Comment(0)
I
0

Honestly, by disabling github extension in VSCode will not solve your problem.

**Check the package.json file and see what "dependencies" are causing the overload **

Example Simply npm uninstall "parcel" This will allow some of those node-modules to clear up.

**If you still would like to add the node-modules && other large packages simply: **

  1. Create a .gitignore.text or use the new file button
  2. type \{enter file name} and it will automatically add all of the children files to .gitignore
  3. git commit -m "" and then you are finished
Injustice answered 16/6, 2021 at 16:44 Comment(0)
G
0

You might have DELETED many projects from your current folder, while git didn't register the deletion.

The simplest solution is to create a new folder and start running VSCode in it.

You can delete the whole old folder, or you can leave it alone. It's up to you.

Gittens answered 24/7, 2021 at 9:11 Comment(0)
T
0

I solved my similar problem by but exiting out of VS Code and using the command line / terminal to add, commit then push files.

Tombola answered 11/8, 2021 at 13:14 Comment(0)
B
0

Just adding my own silly reason for causing this issue incase it helps another...

I cloned a repository from GitHub and then created a python environment ("env") within the same folder in order to install the requirements. It was of course all the new files in my "env" folder that caused VScode to complain about too many changes. Adding "env" to the project's .gitignore resolved the issue.

Bonhomie answered 16/10, 2021 at 9:45 Comment(0)
B
0

Had the exact same problem.

  1. In vscode Right click on "SOURCE CONTROL" at the top of open source control panel, then make sure "Source Control" is selected.

  2. 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

Burks answered 4/2, 2022 at 23:35 Comment(0)
D
0

The git command git add -A ./** saved my life.

Until using this command nothing was working. I also renamed my current directory, went through and removed every single already present .git directory throughout, including the project root and all sub-directories. Added a very new and thorough .gitignore to the project root, and deleted the old remote repository that was previously started but wouldn't finish properly, all of which finally allowed me to start completely over with a brand new clean slate.

As a quick side note - The only trade-off I made (which was more of a personal choice than a trade-off really, anywho...) was for each sub-directory that already contained a .git folder, I could have included those directories as git sub-modules instead of completely deleting those .git directories, which is really the more ideal or proper way of doing it. This was a personal decision, but most likely you will want to make sure to include them as sub-modules rather than deleting them, this way it will allow you to keep not only those repositories commit histories, but also continue to fetch future upstream changes and merge them back into your working directory, so just quick fyi and word of caution here. If you delete them as I did, you will lose all of that, which is probably not what most would want to do I think, so just fyi here!! - Hope that helps somebody!!

The following documentation allowed me to make all of these decisions, which you, yourself, might find useful, just as I did:

Per the git man pages for git add

-A short for --all "Updates the index not only where the working tree has a file matching <pathspec> but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree.

If no <pathspec> is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories)."

Furthermore if you look in their glossary under "glob" you will find usage for a double asterisks like so:

"A trailing /** matches everything inside. For example, abc/** matches all files inside directory abc, relative to the location of the .gitignore file, with infinite depth."

Demogorgon answered 5/10, 2022 at 21:33 Comment(0)
P
0

In my case another extension seems to be the problem. Check if you have any additional Git extensions installed. If so uninstall them and reload your VS Code window.

In my Case "Git Graph" seemed to interfere for some reason.

Prestonprestress answered 25/10, 2022 at 14:50 Comment(0)
L
0

For Mac users do these steps:

Actually the issue is all because you have .git folder in your main root, so to solve this issue do these steps:

1-Open your terminal and go to your main computer root.

2-Write this >> git ls -a to find all hidden files and folders, .git will be one of them.

3-Then write this rm -rf .git to remove .git folder. Dont worry it will not ruin anything.

4-Now reopen your current project you see your source control on Visual Studio is clean.

DONE

Latinity answered 26/11, 2022 at 21:0 Comment(0)
M
-1

Always keep .gitattributes and .gitignore file to avoid such issue

Misrule answered 22/3, 2021 at 22:2 Comment(0)
C
-1

My problem is that I accidentally typed git add . in my users/folder on Win10 lol

Cliffordclift answered 21/10, 2022 at 14:46 Comment(0)
P
-3

enter image description here

The workaround for me is to Simply disable the git extension.

Plumber answered 17/4, 2021 at 15:22 Comment(3)
that's not how it has to be doneDecasyllable
Very funny, tbh. It's true. Sometimes, developers get so frustrated with the error messages that they have to resort to disabling their "helper" extensions.Headboard
This exactly what I want. I want vscode the STFU. Upvoted.Dogberry

© 2022 - 2024 — McMap. All rights reserved.