Reputation: 1955
When I attempt to update Flutter I get the following error.
error: Your local changes to the following files would be overwritten by merge: examples/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj
Please commit your changes or stash them before you merge.
Aborting Updating f9bb4289e..5ab9e7072 Process finished with exit code 1
I suspect at some point I did something in the examples project and I don't care about loosing the changes.
What is the easiest thing to do?
Upvotes: 21
Views: 22727
Reputation: 21
No matter what type of operating system you are using, you need to go to the flutter folder on your computer, open it in the terminal and type the following command:
git reset --hard origin/stable
Everything will be fine afterwards
Upvotes: 1
Reputation: 39
Just inacese someone is still facing this issue. I found a workaround
commit and push your code changes.
download the latest flutter sdk stable version.
end adb in task manager and close visual studio code.
Rename the previous flutter folder to something like "flutter_old".
Paste the new downloaded flutter to src folder.
open Visual Code and run flutter doctor and flutter packages get and you are updated.
Upvotes: 0
Reputation: 360
What worked for me was adding Dart-SDK path C:\Users\Profile-Name\flutter\bin\cache\dart-sdk to Environment Variables under System Variables. Double click on Path, click on New and add/paste your dart-sdk path. Finally open terminal with admin priviledges and run flutter doctor.
Upvotes: 0
Reputation: 1020
I had the same problem and git reset --hard origin/beta
in the flutter home directory fixed it.
In my case git status
revealed that "You have unmerged paths."
Note that for the stable branch you need this:
cd $FLUTTER_HOME
git reset --hard origin/stable
Upvotes: 16
Reputation: 20369
This simply means that you have modified some file from the flutter sdk, to know the modification navigate to the location where you have flutter sdk installed,and enter the command git status
and you will see the name of the files in red color that have been modified e.g for me it was dropdown.dart
you can remove those changes by adding it to stash by running the command
git stash
And now again when you run
git status
it should prompt you saying
nothing to commit, working tree clean
And now you are good to run
flutter upgrade
and get your hands on the latest contributions from the flutter community.
Upvotes: 0
Reputation: 3552
This happened to me too! What i did that worked was to rename flutter.gradle
to anything e.g flutttttterrrr.gradle
then run flutter upgrade
command again.
The file is located at C:\your_flutter_location\flutter_main_folder\packages\flutter_tools\gradle
Hope this helps someone.
Upvotes: 1
Reputation: 25008
Below worked with me to get 1.0.0-stable:
$ git clean -xfd
$ git checkout origin/stable
$ git pull
$ flutter doctor
$ flutter --version
Flutter 1.0.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5391447fae (5 days ago) • 2018-11-29 19:41:26 -0800
Engine • revision 7375a0f414
Tools • Dart 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
Upvotes: 2
Reputation: 658155
In the Flutter install directory please run
git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor
Upvotes: 18
Reputation: 21768
Go to your flutter home directory and do git checkout .
or git reset head --hard
Upvotes: 59