I have two branches locally, master
and Berislav
. The latter is currently active, and I have committed all the changes. When I try to checkout to <
I had the same problem, and this solved my issues (on Linux):
git config --global core.autocrlf input
As the message suggests, rerun the command w/ --force option.
flutter upgrade --force
It seems that you have untracked files in your working copy, which are tracked on the other branch. Git refuses to checkout the other branch, since your currently untracked local files would be overwritten by the files on the other branch.
You can now
I encountered a similar problem today. git status
wasn't listing the files which checkout was complaining about. I did a:
git checkout -- path/to/file
And that undoes any changes to the file.
An even easier way to undo all unstaged changes on current working directory [1]:
git checkout -- .
[1] - Be warned - you will lose any other unstaged changes you were working on (if any). If you don't know what you are doing, then keep a backup of the files you were working on :)
Very similar to @JohnHammink answer but here goes.
Solution
In my case this was because of a file that was renamed with only a change to the case. e.g. fooViewModel to FooViewModel. Git kept thinking that the same file was actually two separate files.
I think this has something to do with Unix being case sensitive while windows not really.
Hope this helps
Move the offending file to some other location. Then delete the offending file from your tree. Pull again. then diff the changes from your offending file over the file you just pulled. hack, but it works.