-1

My project structure is like this:

├── myProject
│   ├── myapp
│   ├── myenv
│   └── db.sqlite3

Each time I run:

git status

I received many status changes of myenv which are not important to me, but the myenv changes are too many, it is very annoying.

I tried to ignore it by creating a .gitignore file:

├── myProject
│   ├── myapp
│   ├── myenv
    ├── db.sqlite3
    └── .gitignore

Inside it:

db.sqlite3
dir_to_ignore/myenv/

But it does not work, after running git status, still lots of status changes of myenv came out.

How can I solve this?

phd
  • 82,685
  • 13
  • 120
  • 165
William
  • 3,724
  • 9
  • 43
  • 76

1 Answers1

1

This usually means a file in that folder has already been added. The quickest way I find to solve this is to run: git rm --cache -r dir_to_ignore/myenv/

Keeping the dir_to_ignore/myenv/ in your .gitignore. The --cache option simply removes the folder from your git index but not from your filesystem. While still being in the .gitignore file means git won't try to add it again.

ricardosmg
  • 51
  • 5