Closed sethladd closed 5 years ago
I had this just now. I switched to master
about a week ago because of issues and now switched back to alpha
and run flutter upgrade
I hit this myself today. It's easy to get into this situation when playing around with the examples gallery. And it's not clear to a non-expert git user (like me) how to get out of this state.
I ran git stash save --keep-index
followed by git stash drop
to dump my changes, and that seemed to work. We should consider either a) moving the examples to a different repo, or b) providing clear instructions on what to do from flutter upgrade
.
Any other thoughts, @mit-mit?
Two ideas come to mind:
.gitignore
all of /examples/
Thoughts @Hixie @mjohnsullivan ?
Seems problematic to include the examples folder in .gitignore
-- if they're untracked, then they wouldn't get updated at all, would they?
You can still track files that are in .gitignore
. But from a bit of testing, it doesn't seem to resolve the "Please commit your changes or stash them before you merge". I defer to the git knowledgeable :-).
Could we perhaps so something like:
flutter upgrade -f
to overwrite these"I never do anything in the flutter
directory and definitely not changing files.
Why are there so often changed files that prevent flutter upgrade
?
I think this has to be a Flutter issue or perhaps the IntelliJ Flutter plugin.
@zoechi What are the changed files?
@mit-mit We could automatically "stash" local changes when upgrading, then give a message if we've done so.
Stashing sgmt! Just make sure the message is useful both to developer that actually use/know git, and it gentle enough that others can ignore it :-)
@Hixie I'll report the list the next time I encounter this issue.
@Hixie
(dart2) $ flutter upgrade
Upgrading Flutter from /Users/zoechi/flutter/flutter...
From https://github.com/flutter/flutter
487e6bc91..d6d874474 dev -> origin/dev
2329cb7ec..cdc68a73e master -> origin/master
* [new tag] v0.2.10 -> v0.2.10
error: Your local changes to the following files would be overwritten by merge:
dev/automated_tests/pubspec.yaml
dev/benchmarks/complex_layout/pubspec.yaml
dev/benchmarks/microbenchmarks/pubspec.yaml
dev/bots/pubspec.yaml
dev/devicelab/pubspec.yaml
dev/integration_tests/channels/pubspec.yaml
dev/integration_tests/external_ui/pubspec.yaml
dev/integration_tests/flavors/pubspec.yaml
dev/integration_tests/platform_interaction/pubspec.yaml
dev/integration_tests/ui/pubspec.yaml
dev/manual_tests/pubspec.yaml
dev/tools/pubspec.yaml
dev/tools/vitool/pubspec.yaml
examples/catalog/pubspec.yaml
examples/flutter_gallery/pubspec.yaml
examples/hello_world/pubspec.yaml
examples/layers/pubspec.yaml
examples/platform_channel/pubspec.yaml
examples/platform_channel_swift/pubspec.yaml
examples/stocks/pubspec.yaml
packages/flutter/pubspec.yaml
packages/flutter_driver/pubspec.yaml
packages/flutter_localizations/pubspec.yaml
packages/flutter_test/pubspec.yaml
packages/flutter_tools/pubspec.yaml
packages/fuchsia_remote_debug_protocol/pubspec.yaml
Please commit your changes or stash them before you merge.
Aborting
Updating 487e6bc91..d6d874474
Is flutter update-packages --force-upgrade
making this changes?
Ah yes, flutter update-packages --force-upgrade
is a tool for making local changes to your branch for submitting a PR. You shouldn't need to run it unless you want to submit a PR.
Ok this bug is for automatically calling git stash push -m'Changes in tree prior to Flutter upgrade from v0.4.9 to v0.5.3'
(or equivalent) before upgrading if necessary, combined with showing a message that says something like "Your Flutter repository contained uncommitted changes. They have been saved in the git stash."
I had similar issue:
Upgrading Flutter from /Users/josemboa/flutter... error: Your local changes to the following files would be overwritten by merge: AUTHORS CONTRIBUTING.md bin/flutter.bat bin/internal/engine.version dev/automated_tests/flutter_test/test_async_utils_unguarded_expectation.txt dev/automated_tests/flutter_test/ticker_expectation.txt dev/automated_tests/flutter_test/trivial_widget_expectation.txt dev/bots/test.dart dev/devicelab/bin/tasks/gradle_plugin_test.dart dev/devicelab/lib/tasks/perf_tests.dart dev/devicelab/manifest.yaml dev/integration_tests/channels/lib/src/basic_messaging.dart dev/manual_tests/lib/color_testing_demo.dart dev/tools/dartdoc.dart examples/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj examples/flutter_gallery/lib/demo/cupertino/cupertino_dialog_demo.dart examples/flutter_gallery/lib/demo/material/material.dart examples/flutter_gallery/lib/demo/shrine/shrine_home.dart examples/flutter_gallery/lib/demo/video_demo.dart examples/flutter_gallery/lib/gallery/app.dart examples/flutter_gallery/lib/gallery/home.dart examples/flutter_gallery/lib/gallery/syntax_highlighter.dart examples/flutter_gallery/lib/main.dart examples/flutter_gallery/pubspec.yaml examples/flutter_gallery/test/drawer_test.dart examples/flutter_gallery/test/example_code_display_test.dart examples/flutter_gallery/test/live_smoketest.dart examples/flutter_gallery/test/pesto_test.dart examples/flutter_gallery/test/simple_smoke_test.dart examples/flutter_gallery/test/smoke_test.dart examples/flutter_gallery/test/update_test.dart examples/flutter_gallery/test_driver/memory_nav.dart examples/flutter_gallery/test_driver/scroll_perf.dart examples/flutter_gallery/test_driver/transitions_perf.dart examples/flutter_gallery/test_driver/transitions_perf_test.dart examples/platform_view/README.md examples/platform_view/ios/Podfile examples/platform_view/ios/Podfile.lock examples/platform_view/ios/Runner.xcodeproj/project.pbxproj examples/stocks/lib/stock_data.dart packages/flutter/lib/material.dart packages/flutter/lib/src/animation/curves.dart packages/flutter/lib/src/cupertino/dialog.dart packages/flutter/lib/src/cupertino/icons.dart packages/flutter/lib/src/cupertino/refresh.dart packages/flutter/lib/src/cupertino/slider.dart packages/flutter/lib/src/cupertino/thumb_painter.dart packages/flutter/lib/src/foundation/basic_types.dart packages/flutter/lib/src/foundation/binding.dart packages/flutter/lib/src/foundation/consolidate_response.dart packages/flutter/lib/src/foundation/debug.dart packages/flutter/lib/src/gestures/velocity_tracker.dart packages/flutter/lib/src/material/app_bar.dart packages/flutter/lib/src/material/card.dart packages/flutter/lib/src/material/checkbox.dart packages/flutter/lib/src/material/chip.dart packages/flutter/lib/src/material/colors.dart packages/flutter/lib/src/material/constants.dart packages/flutter/lib/src/material/data_table.dart packages/flutter/lib/src/material/date_picker.dart packages/flutter/lib/src/material/feedback.dart packages/flutter/lib/src/material/ink_ripple.dart packages/flutter/lib/src/material/ink_well.dart packages/flutter/lib/src/material/input_decorator.dart packages/flutter/lib/src/material/list_tile.dart packages/flutter/lib/src/material/material_localizations.dart packages/flutter/lib/src/material/popup_menu.dart packages/flutter/lib/src/material/progress_indicator.dart packages/flutter/lib/src/material/radio.dart packages/flutter/lib/src/material/scaffold.dart packages/flutter/lib/src/material/switch.dart packages/flutter/lib/src/material/text_field.dart packages/flutter/lib/src/material/theme_data.dart packages/flutter/lib/src/material/time_picker.dart packages/flutter/lib/src/material/toggleable.dart packages/flutter/lib/src/painting/basic_types.dart packages/flutter/lib/src/painting/box_decoration.dart packages/flutter/lib/src/painting/box_fit.dart packages/flutter/lib/src/painting/gradient.dart packages/flutter/lib/src/painting/image_resolution.dart packages/flutter/lib/src/painting/text_style.dart packages/flutter/lib/src/physics/tolerance.dart packages/flutte Aborting Updating f9bb4289e..c7ea3ca37
I ran git reset --hard and the flutter upgrade worked fine
This might also happen if you have the code on a shared windows partition running on a Linux installation.
Since file permissions are rewritten to certain defaults, every file might appear as changed to git.
Just set core.filemode
to false for the repository.
$ git config core.filemode false
I can't get it to go away. Please help
mwc-034148:flutterThumbsout brett$ flutter upgrade
Upgrading Flutter from /Users/brett/flutterDeveloper/flutter/flutter...
error: Your local changes to the following files would be overwritten by merge:
dev/automated_tests/pubspec.yaml
dev/benchmarks/complex_layout/pubspec.yaml
dev/benchmarks/microbenchmarks/pubspec.yaml
dev/bots/pubspec.yaml
dev/devicelab/pubspec.yaml
dev/integration_tests/channels/pubspec.yaml
dev/integration_tests/external_ui/pubspec.yaml
dev/integration_tests/flavors/pubspec.yaml
dev/integration_tests/platform_interaction/pubspec.yaml
dev/integration_tests/ui/pubspec.yaml
dev/manual_tests/pubspec.yaml
dev/tools/pubspec.yaml
dev/tools/vitool/pubspec.yaml
examples/catalog/pubspec.yaml
examples/flutter_gallery/pubspec.yaml
examples/hello_world/pubspec.yaml
examples/layers/pubspec.yaml
examples/platform_channel/pubspec.yaml
examples/platform_channel_swift/pubspec.yaml
examples/stocks/pubspec.yaml
packages/flutter/lib/src/material/expansion_tile.dart
packages/flutter/pubspec.yaml
packages/flutter_driver/pubspec.yaml
packages/flutter_goldens/pubspec.yaml
packages/flutter_localizations/pubspec.yaml
packages/flutter_test/pubspec.yaml
packages/flutter_tools/pubspec.yaml
packages/fuchsia_remote_debug_protocol/pubspec.yaml
Please commit your changes or stash them before you merge.
Aborting
Updating 953db753a..e1a3e1bfd
mwc-034148:flutterThumbsout brett$
@bdytx5
git clean -xfd
git pull
flutter doctor
in the flutter install directory
Ok, sorry for my lack of experience, but when I run any git command in the flutter install directory, I get the "Not a git repository" message. My project folder is the only folder with a git repository initialized, and I am unaware of any flutter install directory within my project?
@bdytx5 that sounds like you downloaded a zip archive instead of using git clone ...
to create the Flutter install directory.
I'm pretty sure this is only supposed to work if you used git clone ...
Can you run the following commands and paste the output please:
pwd
ls -al
git status
git clean -xfd
git pull
flutter -v doctor
flutter -v upgrade
mwc-034148:flutterThumbsout brett$ pwd
/Users/brett/flutter/thumbsout/flutterThumbsout
mwc-034148:flutterThumbsout brett$ ls -al
total 208
drwxr-xr-x 23 brett staff 736 Jul 26 00:55 .
drwxr-xr-x 3 brett staff 96 Jul 26 00:55 ..
drwxr-xr-x 13 brett staff 416 Jul 26 00:58 .git
-rw-r--r-- 1 brett staff 109 Jul 26 00:55 .gitignore
-rw-r--r-- 1 brett staff 284 Jul 26 00:55 .metadata
-rw-r--r-- 1 brett staff 148 Jul 26 00:55 README.md
drwxr-xr-x 10 brett staff 320 Jul 26 00:55 android
drwxr-xr-x 9 brett staff 288 Jul 26 00:55 assets
-rw-r--r-- 1 brett staff 5407 Jul 26 00:55 flutter_01.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_02.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_03.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_04.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_05.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_06.log
-rw-r--r-- 1 brett staff 5454 Jul 26 00:55 flutter_07.log
-rw-r--r-- 1 brett staff 6535 Jul 26 00:55 flutter_08.log
drwxr-xr-x 14 brett staff 448 Jul 26 00:55 ios
drwxr-xr-x 11 brett staff 352 Jul 26 00:55 lib
-rw-r--r-- 1 brett staff 835 Jul 26 00:55 newproj.iml
-rw-r--r-- 1 brett staff 1386 Jul 26 00:55 newproj_android.iml
-rw-r--r-- 1 brett staff 12544 Jul 26 00:55 pubspec.lock
-rw-r--r-- 1 brett staff 2398 Jul 26 00:55 pubspec.yaml
drwxr-xr-x 3 brett staff 96 Jul 26 00:55 test
mwc-034148:flutterThumbsout brett$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
mwc-034148:flutterThumbsout brett$ git clean -xfd
mwc-034148:flutterThumbsout brett$ git pull
Already up-to-date.
mwc-034148:flutterThumbsout brett$ flutter -v doctor
[✓] Flutter (Channel master, v0.5.8-pre.72, on Mac OS X 10.13 17A405, locale en-US)
• Flutter version 0.5.8-pre.72 at /Users/brett/flutterDeveloper/flutter/flutter
• Framework revision 953db753ab (8 days ago), 2018-07-18 16:29:26 -0700
• Engine revision 5557e3006e
• Dart version 2.0.0-dev.67.0.flutter-84ca27a09e
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
• Android SDK at /Users/brett/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.1
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.5.3
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[✓] Connected devices (1 available)
• iPhone X • 0CF2C3DA-07A1-48BF-B820-A0FAE1418212 • ios • iOS 11.2 (simulator)
• No issues found!
mwc-034148:flutterThumbsout brett$ flutter -v upgrade
[ +41 ms] [/Users/brett/flutterDeveloper/flutter/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +48 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] origin/master
[ ] [/Users/brett/flutterDeveloper/flutter/flutter/] git rev-parse --abbrev-ref HEAD
[ +12 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] master
[ ] [/Users/brett/flutterDeveloper/flutter/flutter/] git ls-remote --get-url origin
[ +10 ms] Exit code 0 from: git ls-remote --get-url origin
[ ] https://github.com/flutter/flutter.git
[ ] [/Users/brett/flutterDeveloper/flutter/flutter/] git log -n 1 --pretty=format:%H
[ +10 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[ ] 953db753ab28b6147044c8d85add9ee0a953bf69
[ ] [/Users/brett/flutterDeveloper/flutter/flutter/] git log -n 1 --pretty=format:%ar
[ +11 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[ ] 8 days ago
[ +1 ms] [/Users/brett/flutterDeveloper/flutter/flutter/] git describe --match v*.*.* --first-parent --long --tags
[ +20 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[ ] v0.5.7-72-g953db753a
[ +107 ms] [/Users/brett/flutterDeveloper/flutter/flutter/] git rev-parse @{u}
[ +54 ms] e1a3e1bfd8c52153af01f1e6f361f5f398e92862
[ +1 ms] Upgrading Flutter from /Users/brett/flutterDeveloper/flutter/flutter...
[ +3 ms] [/Users/brett/flutterDeveloper/flutter/flutter/] git pull --ff-only
[+2126 ms] From https://github.com/flutter/flutter
[ +1 ms] e1a3e1bfd..f72c514c5 master -> origin/master
[ +23 ms] error: Your local changes to the following files would be overwritten by merge:
[ ] dev/automated_tests/pubspec.yaml
[ ] dev/benchmarks/complex_layout/pubspec.yaml
[ ] dev/benchmarks/microbenchmarks/pubspec.yaml
[ ] dev/bots/pubspec.yaml
[ ] dev/devicelab/pubspec.yaml
[ ] dev/integration_tests/channels/pubspec.yaml
[ ] dev/integration_tests/external_ui/pubspec.yaml
[ ] dev/integration_tests/flavors/pubspec.yaml
[ ] dev/integration_tests/platform_interaction/pubspec.yaml
[ ] dev/integration_tests/ui/pubspec.yaml
[ ] dev/manual_tests/pubspec.yaml
[ ] dev/tools/pubspec.yaml
[ ] dev/tools/vitool/pubspec.yaml
[ ] examples/catalog/pubspec.yaml
[ ] examples/flutter_gallery/pubspec.yaml
[ ] examples/hello_world/pubspec.yaml
[ ] examples/layers/pubspec.yaml
[ ] examples/platform_channel/pubspec.yaml
[ ] examples/platform_channel_swift/pubspec.yaml
[ ] examples/stocks/pubspec.yaml
[ ] packages/flutter/lib/src/material/expansion_tile.dart
[ ] packages/flutter/pubspec.yaml
[ ] packages/flutter_driver/pubspec.yaml
[ ] packages/flutter_goldens/pubspec.yaml
[ ] packages/flutter_localizations/pubspec.yaml
[ ] packages/flutter_test/pubspec.yaml
[ ] packages/flutter_tools/pubspec.yaml
[ ] packages/fuchsia_remote_debug_protocol/pubspec.yaml
[ ] Please commit your changes or stash them before you merge.
[ ] Aborting
[ ] Updating 953db753a..f72c514c5
[ +23 ms] "flutter upgrade" took 2,315ms.
#0 throwToolExit (package:flutter_tools/src/base/common.dart:26:3)
#1 UpgradeCommand.runCommand (package:flutter_tools/src/commands/upgrade.dart:53:7)
<asynchronous suspension>
#2 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:347:18)
#3 _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64)
#4 _rootRunUnary (dart:async/zone.dart:1134:38)
#5 _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#6 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
#7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:638:45)
#8 Future._propagateToListeners (dart:async/future_impl.dart:667:32)
#9 Future._complete (dart:async/future_impl.dart:472:7)
#10 _SyncCompleter.complete (dart:async/future_impl.dart:51:12)
#11 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20)
#12 _rootRun (dart:async/zone.dart:1126:13)
#13 _CustomZone.run (dart:async/zone.dart:1023:19)
#14 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
#15 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
#16 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
#17 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:113:13)
#18 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:166:5)
I was able to create a new flutter install directory using the "git clone" command instead of downloading the zip file, and then I copied the project into that directory, and then I followed zoechi's advice, and that seemed to fix my problem.
Only problem I'm having now is that I'm unable to install any plugins. When I add the dependency to my pubspec.yaml, and run "flutter packages get", nothing seems to really happen, and when I run a pod install, I get this message "[!] No podspec found for "my dependency."
Do you run pod install
in the ios/
subdirectory?
What do you expect from flutter packages get
to happen?
Can you please post the output of flutter packages get --trace
?
Yes, I am running pod install from /ios. Here is my output for packages get after adding the mapbox dependency. Also, usually when I click the "packages get" button from android studio or intellij, the button will disappear after I click it, but now it doesn't disappear. When I run packages get from the terminal, it will usaully take more that a few seconds to work. These two abnormalities and the output from the pod install command leads me to believe that something is wrong..
Also, it doesn't seem to recognize the --trace command
flutter packages get
Running "flutter packages get" in thumbsoutdos... 1.6s
Bretts-Macintosh:thumbsoutdos brett$ cd ios
Bretts-Macintosh:ios brett$ pod install
Analyzing dependencies
Fetching podspec for Flutter
from .symlinks/flutter/ios
Fetching podspec for firebase_auth
from .symlinks/plugins/firebase_auth/ios
Fetching podspec for firebase_core
from .symlinks/plugins/firebase_core/ios
Fetching podspec for firebase_database
from .symlinks/plugins/firebase_database/ios
Fetching podspec for firebase_messaging
from .symlinks/plugins/firebase_messaging/ios
Fetching podspec for firebase_storage
from .symlinks/plugins/firebase_storage/ios
Fetching podspec for flutter_facebook_login
from .symlinks/plugins/flutter_facebook_login/ios
Fetching podspec for flutter_webview_plugin
from .symlinks/plugins/flutter_webview_plugin/ios
Fetching podspec for google_sign_in
from .symlinks/plugins/google_sign_in/ios
Fetching podspec for image_cropper
from .symlinks/plugins/image_cropper/ios
Fetching podspec for image_picker
from .symlinks/plugins/image_picker/ios
Fetching podspec for mapbox_gl
from .symlinks/plugins/mapbox_gl/ios
[!] No podspec found for mapbox_gl
in .symlinks/plugins/mapbox_gl/ios
Bretts-Macintosh:ios brett$ flutter packages get --trace
Could not find an option named "trace".
Run 'flutter -h' (or 'flutter
well I just came to the realization that the mapbox dependency I chose to test was actually specifically for android only, and normal ios dependencies work fine.... just having a bad day I guess... Thanks for your help.
Glad to hear you figured it out. It would have been flutter packages get -v
Had the same problem when upgrading to 1.0
git reset --hard
did it for me ( in the flutter dir, which would by defaut be /Users/yourusername/Library/flutter )
in #25220 I propose a --force
parameter for that
Related #1963
Go to your flutter home directory and do git reset head --hard
Had the same problem when upgrading to 1.0
git reset --hard
did it for me ( in the flutter dir, which would by defaut be /Users/yourusername/Library/flutter )
This worked for me too....
flutter upgrade
now warns if there are local commits or changes, and suggests stashing as a workaround. There is also a --force
parameter which will handle discarding local changes in the flutter repo
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
This is what you see when you run
flutter upgrade
but have a conflict:Note the "Updating ..." which I thought meant "update complete!"
Actually, due to the conflict when merging, the update didn't complete. :/
Can we print out a clearer message when the update fails? Something like: "Upgrade failed. Please see output above, or run flutter upgrade -v for more info."
Thanks!