What is the best practice for uploading a Flutter project to GitHub

924

Are you committing the generated app files? have you looked into .gitignores? they exclude files e.g. https://github.com/flutter/flutter/blob/master/.gitignore

but remove the Flutter repo-specific stuff, like this:

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

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

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.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/Flutter/flutter_export_environment.sh
**/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:
924
arrmani88
Author by

arrmani88

Updated on December 30, 2022

Comments

  • arrmani88
    arrmani88 over 1 year

    Since I'm working on my Flutter project, I made a lot of operations that creates some files (generating bytecode, cache files, ... etc), and sometimes these generated files and executables are too large and exceed the allowed size on GitHub (100 MB).

    Now I want to upload my project to GitHub but without uploading the generated files.
    How can I clean my flutter project before pushing it?

  • arrmani88
    arrmani88 almost 3 years
    thanks, my .gitignore wasn't like this one
  • Iain Smith
    Iain Smith almost 3 years
    No worries, if you have committed files you might need to do something like this stackoverflow.com/questions/6535362/gitignore-after-commit