将 Flutter 项目上传到 GitHub 的最佳实践是什么

问题描述 投票:0回答:2

由于我正在开发我的 Flutter 项目,我做了很多创建一些文件的操作(生成字节码、缓存文件等),有时这些生成的文件和可执行文件太大并超出了允许的大小GitHub(100 MB)。

现在我想将我的项目上传到 GitHub,但不上传生成的文件。
在推送之前如何清理我的 flutter 项目?

flutter github
2个回答
4
投票

您是否提交生成的应用程序文件?你研究过 .gitignores 吗?他们排除文件,例如https://github.com/flutter/flutter/blob/master/.gitignore

但删除 Flutter 存储库特定的内容,如下所示:

# 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

0
投票

Step-1 创建 Flutter 项目 Step-2 打开终端 Step-3 逐步执行远程上传项目的所有命令。 → 1. git init → 2. git add 。 → 3. git commit -m "description" → 4. gitbranch -M 分支名称 → 5. git 远程添加源 repoUrl → 6. git push -u 源分支名称

© www.soinside.com 2019 - 2024. All rights reserved.