1

I just started using vscode editor and when I checked git status I saw that it has the warning of the .vscode/ file not being tracked. How do I have it ignore this? When I added this to the .gitignore file, it then said I made changes to the .gitignore file. I always thought that this file would automatically be ignored by git and wouldn't be tracked as its changes should only ever be saved to my local copy?

2 Answers 2

8

.gitignore is something that should be under version control. This way all people who checkout the project will also be persuaded away from trying to commit their .vscode/ directory.

.gitignore is not specific to your environment, but rather the repository.


If you really don't want to put this rule in the repo's .gitignore, then you can setup a per-user ignore file:

git config --global core.excludesfile $HOME/.gitignore 
Sign up to request clarification or add additional context in comments.

Comments

0

If you don't want to change the .gitignore file, you can create rules that will only apply to you.

You can use this rule for locally generated files, that you don't expect others to generate, such as files created by your editor.

Open this file called .git/info/exclude within the root of your Git repository(project dir) and add your rules.

If you have vim, you can do so with vi .git/info/exclude

Any rule you add here will not be checked in, and will only ignore files for your repository.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.