Flutter, which folder not to commit to svn

4,893

Solution 1

Do android and ios folder need to commit to svn?

Yes, always comit these folders to svn(but you can skip some auto generated files)

There are three main folders in the Flutter project: lib, android and ios.

lib takes care of your Dart files. The Android and iOS folders exist to actually build an app on those respective platforms with the Dart files running on them. They also help you add permissions and platform-specific functionality to your project. When you run a Flutter project, it builds depending on which emulator or device it is running on, doing a Gradle or XCode build using the folders inside it.

In short, those folders are entire apps which set the stage for the Flutter code to run.

Don’t commit the following files and directories:

# See https://www.dartlang.org/tools/private-files.html

# Files and directories created by pub
.packages
.pub/
build/
# If you're building an application, you may want to check-in your pubspec.lock
pubspec.lock

# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/

From flutter create:

.DS_Store
.atom/
.idea
.packages
.pub/
build/
ios/.generated/
packages
pubspec.lock
.flutter-plugins

For more information please refer this to check which files are auto generated.

Hope this will helps you

Solution 2

If you create a Flutter project it contains 3 .gitignore files.
One in the project root and one in each ios/ and android/.
These files already cover most cases.

update

They unified these 3 .gitignore into a single one

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

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

# Visual Studio Code related
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
build/

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

# 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.*

# 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
Share:
4,893
stuckedoverflow
Author by

stuckedoverflow

Full Stack Developer Sr. Manager

Updated on December 07, 2022

Comments

  • stuckedoverflow
    stuckedoverflow 28 days

    Do android and ios folder need to commit to svn?

    I believe /build .packages are not to be committed.

    I haven't found detailed docs on this topic. I only find this https://www.dartlang.org/guides/libraries/private-files

    I'm aware there is .gitignore file but I think this file is ignored because I'm using TortoiseSVN. Every time I commit I got like 200+ files committed. And may affect other users when they do update.

    enter image description here

  • stuckedoverflow
    stuckedoverflow about 4 years
    I only have 1 .gitignore on the root....And because I'm using svn I think this file is "ignored" too :)
  • Günter Zöchbauer
    Günter Zöchbauer about 4 years
    The last time I checked they were 3 but I remember seeing discussions that they should be merged and in a newly created project there is now only 1 such file. I updated my answer.
  • stuckedoverflow
    stuckedoverflow about 4 years
    Can I use svn to take this .gitignore file?
  • Günter Zöchbauer
    Günter Zöchbauer about 4 years
    There seems to be something similar stackoverflow.com/questions/11293539/…. You would need to convert it yourself
  • Alex Roy
    Alex Roy over 2 years
    what about ios/build/ folder, ios/Podfile and ios/Podfile.lock file?
  • Günter Zöchbauer
    Günter Zöchbauer over 2 years
    Lockfiles for application projects depends on your preferences. For published packages you usually should not commit them. Otherwise check github.com/flutter/gallery/blob/master/.gitignore That file is kept updated.