VSCode Explorer always excludes files in .gitignore - visual-studio-code

Using VS Code 1.74.2, any files or folders in .gitignore are excluded from the File Explorer tree. None of the solutions seen on the web work...
"explorer.excludeGitIgnore": false, doesn't work
files: exclude doesn't work
Isn't .gitignore meant to indicate files and folders you don't want in the repository? If yes, then why does it also remove them from the VS Code file explorer. What can I do to stop files and folders going into the repository but still have them visible in the File Explorer tree?
Thanks

Related

Visual Studio Code source control full of 'changes' I was not aware of

How do I get rid of these 'changes' on Visual Studio Code? There are over thousands of files and I was not aware of these changes since I installed vs code on my MacBook. I tried git reset --hard on the terminal, but nothing has happened. I also do not recall having these files on my laptop and VS Code cannot even open these files. VS Code also failed to notify me of these 'changes'. Whenever I try to delete all the files, it says git: fatal: you are on a branch yet to be born
See screenshot below:
All of these "changes" are most likely do to you initializing git in a folder with lots of settings and configuration folders. For example, in the screenshot, I can see that most of the "changes" are from .eclipse folder, a folder Eclipse uses to store configurations. You usually cannot see these folders, because they are "hidden" folders.
Solution 1
The first solution is to add a .gitignore file, to ignore all of those unnecessary folders. To do this, just add a file named .gitignore to the current folder. Then in that file, put a list of all of the folders to be ignored. For example(Go through the list of "changes" and add more folders):
/.eclipse
Solution 2
The other solution to seeing these changes is just deleting the .git folder. You can't see this folder by default, because it is a hidden folder. To see this, you have to go to Finder, and press Command + Shift + .. After you see the .git folder, you can just delete it. The changes should now go away.

.gitignore not appearing in VScode's file explorer

In the standard Windows Explorer, the repo contains all the expected files: A snip of my file directory.
In VSCode, the .gitignore file does not display in the explorer. It's still seemingly functional (all files in the .gitignore are ignored), but it poses an annoyance. Most notably, the .gitignore file does appear in other repos that I have on my machine.
Help would be appreciated.
Check in your project folder .vscode/settings.json.
In section files.exclude most likely you will see the line
"**/.gitignore":true
Comment out or delete it and the file will appear in Visual Code Explorer

.gitignore not ignoring a folder within a directory

It seems a straightforward one, but having researched multiple ways to do it, I can't gitignore a folder within a directory.
I have a root directory which contains all of my code in it. Because it has some back-end NodeJS stuff in it, it has a 'node_modules' folder which contains hundreds of files. As a result, when I try to upload the entire parent folder, GitHub says there's too many files to upload and tells me to reduce the number I'm uploading.
The crucial part is though, the folder has to be uploaded as a whole, as it itself is within a GitHub repository with other files with different folders in.
That means when I go onto my repository, I need this folder's files to display within the folder, and not separately within the repository. I need all of the files to be within this folder, within the parent repository, excluding the node_modules folder.
For example ->
Parent repository -> Child Directory (what I'm uploading) -> Individual files
I've tried to add the node_modules folder to my gitignore through the following methods:
Adding: node_modules/ to my gitignore file
Writing: echo node_modules >> .gitignore through my terminal
Adding a separate gitignore file within my node_modules file with a * in it
None of them have worked and I can't find any other solutions. For reference I'm using a Mac.
Does anyone have any idea what I'm doing wrong, or how it'd be best to do it?
By default, you do not need to include the node_modules folder in your repositories because the package.json file contains all of your project's dependency information. This means that anyone who clones your repository can run npm install and have the entire node_modules folder without problems.
To solve this you can create your own .gitignore file, creating a new file at the root of your project and renaming it to .gitignore (writing exactly that way). Then you can open it with any text editor and add */node_modules to one of the lines.
This will likely solve your problem.

How to ignore files via GUI in Gitkraken?

I come from SourceTree to board the GitKraken hype train. It has always been pretty easy to ignore files within ST. Just right-click on a file in the unstaged container and you've all the options. You can ignore the files directly, each file beneath a specific folder etc. (so, all the .gitignore stuff from within the GUI =)).
However, I can't find a similar feature in GitKraken. Does anybody know how I can ignore files via the GUI of GitKraken?
Please note: This is not a git question. I absolutely know in depth how ignoring files in Git work. But that's not the topic whatsoever. This is just a trivial GitKraken support question.
Currently there isn't an option to ignore a file through the GitKraken GUI.
If you check their post on twitter this is planned to be implemented soon and it will be in their release notes once this is completed.
UPDATE (26.01.2017.):
Version 2.0.0 brings the .gitignore option to the list of functionalities. You can now select a file or folder in the file staging area, and add to the .gitignore file on the fly. Right-click and select Ignore. From there, you can:
Add that specific file to .gitignore
Add all files with that file extension to .gitignore
Add all files in the same folder as the selected file to
.gitignore
(If selecting a folder) add that folder to the .gitignore

How do I remove Mercurial .HG folder from project but still keep it under source control?

I am using Visual Studio 2010 and
I noticed when I published my project that all the files in the published directory were also under source control which I don't want. When I looked at one of my other projects under source control I noticed it didn't have the .hg folder and publishes without issue. I then removed the .hg folder and I was able to build and publish and the files were no longer under source control BUT now my project isn't either.
I put back the .hg folder and I'm back where I started. How do I remove the .hg folder from my project but still retain source control?
The .hg directory cannot be removed. It contains everything Mercurial knows about your project. Deleting that directory effectively removes all source control.
Add files you don't want to be tracked to the .hgignore file in the root of your repository instead. See the hgignore documentation for the format of this file.