These are the lines in my .gitignore concerning the files generated by flutter pub run build_runner build --delete-conflicting-outputs
*.freezed.dart
*.g.dart
I tried
git rm -rf --cached .
git add .
and still *.freezed.dart
and *.g.dart
get added again
CodePudding user response:
If I'm understanding your question correctly; if the files have been previously tracked by git then you need to remove the files then commit those changes to the repository to remove them from git but keeps the local copies.
git rm -r --cached .
git add .
git commit -m "remove ignored files"
Alternatively, you could simply remove the file/dir directly:
git rm -r --cached <file>
File/dir should no longer be tracked following next commit
CodePudding user response:
Check if the *.freezed.dart
and *.g.dart
which keep getting added again are part of a nested repository, or a submodule folder.
In both cases (nested or submodule), the .gitignore
in the parent folder of those sub-repositories would not apply to said sub-repositories content.
So go in the parent folder of one of those files and type: git rev-parse --show-toplevel
CodePudding user response:
I don't understand why, but I changed
*.freezed.dart
*.g.dart
for
*.g.dart
*.freezed.dart
and it started working