git add adding ignored files

后端 未结 10 2278
不知归路
不知归路 2021-02-01 00:58

I\'m trying to remove a previously tracked directory from git, which works, but it\'s being added back with each subsequent git add ., git add -A, etc.

10条回答
  •  甜味超标
    2021-02-01 01:30

    I've found a way to add files to .gitignore even if they have already been commited once. It's a bit brutal but it works great.

    1. Add the different files to your .gitignore

    2. Move these files out from your git project

    3. Rescan & StageChanged, these operation will tell you that these files have been deleted

    4. Commit

    5. Move back your files to your project, they won't be tracked anymore !

提交回复
热议问题