arrmani88
arrmani88

Reputation: 1082

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

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?

Upvotes: 4

Views: 5023

Answers (2)

Abdallah Sayed
Abdallah Sayed

Reputation: 1

  1. Create a Flutter Project
  2. Open Terminal
  3. Step-by-step all commands to upload project remotely.
    1. git init
      
    2. git add . 
      
    3. git commit -m "description"
      
    4. git branch -M branchName
      
    5. git remote add origin repoUrl
      
    6. git push -u origin branchName
      

Upvotes: 0

Iain Smith
Iain Smith

Reputation: 9703

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

Upvotes: 4

Related Questions