0

I have these as the contents of my .gitignore file in my repo directory:

.history
.vs
sh.exe.stackdump

The .gitignore file is saved. Yet when I do a git status, I'm still seeing files in the .history and in the .vs directory:

    modified:   .vs/ProjectSettings.json
    modified:   .vs/VSWorkspaceState.json
    modified:   .vs/aws_scripts/v15/.suo
    modified:   .vs/slnx.sqlite
    new file: 
.history/python/virtualenvs3/boto3/aws_ec2_terminate_instances_20190313130950.py
            new file:   .history/python/virtualenvs3/boto3/aws_ec2_terminate_instances_20190313143848.py
            new file:   .history/python/virtualenvs3/boto3/aws_ec2_terminate_instances_20190313143932.py

What am I doing wrong? How can I exclude these directories?

bluethundr
  • 1,005
  • 17
  • 68
  • 141

1 Answers1

2

.gitignore doesn't work for files that are already tracked.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • To untrack a file, you can use `git rm --cached ` – Ferrybig Mar 29 '19 at 20:24
  • @Ferrybig it's just not that simple. You can remove the file going forward.... but then you do: `git checkout HEAD~1; git checkout my-branch` and then the file is gone from the working tree... and you start to wonder why that happened in the first place. – eftshift0 Mar 29 '19 at 20:25