Configuration of ignored files in Flutter

Flutter project .gitignore configuration

gitignore configuration file

You can refer to the official flutter's .gitignore file

# Miscellaneous
*.class
*.log
*.pyc
*.swp
*.lock
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
**/generated_plugin_registrant.dart
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds


# Flutter repo-specific
/bin/cache/
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/devicelab/ABresults*.json
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version
analysis_benchmark.json
/bin/internal/bootstrap.bat
/bin/internal/bootstrap.sh

# packages file containing multi-root paths
.packages.generated

### Android ###
# Built application files
*.apk
*.ap_
*.aab

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/


# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/app/build
.gradle/
**/android/key.properties
*.jks


# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
**/ios/Flutter/flutter_export_environment.sh
**/ios/Flutter/.last_build_id
**/ios/Podfile.lock
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/ephemeral

# Web related
lib/generated_plugin_registrant.dart

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/ios/build/

**/pubspec.lock
**/.flutter-plugins-dependencies


# macOS
**/Flutter/ephemeral/
**/Pods/
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/ephemeral
**/xcuserdata/

# Windows
**/windows/flutter/generated_plugin_registrant.cc
**/windows/flutter/generated_plugin_registrant.h

# Linux
**/linux/flutter/generated_plugin_registrant.cc
**/linux/flutter/generated_plugin_registrant.h

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!/dev/ci/**/Gemfile.lock

The above is the content that needs to be configured in the .gitignore file, just copy and paste and replace

Configured .gitignorebut did not take effect,

This is because it has been added to git before configuration, so it needs to be reconfigured:

  • Input · git rm -r --cached .clear cache, cancel association

  • Enter git add .to re-add into git

  • enter git commit -m "xxxx" submit again

  • Push again and ignore it to take effect

Guess you like

Origin blog.csdn.net/MrLizuo/article/details/127766845