I'm having trouble using .gitignore
with my .vscode
folder in my repository.
I added a rule in my .gitignore
to ignore my entire .vscode/
folder:
# Visual Studio Code #
.vscode/*
.vscode/settings.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history.vscode/settings.json
Despite this, .vscode
is still being tracked by my local git repository. I've tried a variety of different solutions including using git filter-branch
to remove this folder from my git history and git rm --cached .vscode
to clear my cache and re-commit my changes, but none of these solutions prevents the .vscode folder from being tracked by git.
When I run git status
I keep getting this result:
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.vscode/
nothing added to commit but untracked files present (use "git add" to track)
So far, I've worked around this by manually excluding this folder when I git add
my changes.
Why is .vscode/
still being shown as untracked? If I were to git add .
and git commit
this, it would add this folder to my git history and eventually to my remote repository when I git push
. I don't want this behavior to occur.
Maybe try this in your .gitignore. This should ignore the entire .vscode directory, no matter where it is located.
**/.vscode/