万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

Flutterでなぜかチャンネルがdevにならない

なぜかstableなチャンネルしかない。

> flutter channel
Flutter channels:
* stable

どうやっても切り替わらない・・。

flutter channel dev

Flutterブランチでこれでもだめ

git fetch --prune
> flutter upgrade --force
Flutter is already up to date on channel stable
Flutter 1.17.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 5f21edf8b6 (3 days ago) • 2020-05-28 12:44:12 -0700
Engine • revision b851c71829
Tools • Dart 2.8.3
> flutter channel dev
Switching to flutter channel 'dev'...
git: fatal: 'origin/dev' is not a commit and a branch 'dev' cannot be created from it
Switching channels failed with error code 128.

https://stackoverflow.com/questions/54381620/error-when-trying-to-run-flutter-upgrade

これも試してもだめ。

git clean -xfd
git stash save --keep-index
git stash drop
git pull

結果

Removing bin/cache/
Removing packages/flutter_tools/.dart_tool/
Removing packages/flutter_tools/.packages
Removing packages/flutter_tools/pubspec.lock
Removing version
No local changes to save
No stash entries found.
Already up to date.

もしかすると最初これで落としたのかも?

git clone https://github.com/flutter/flutter.git -b stable --depth 1

うまく動いてるやつの.git/config設定を見ると

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
        ignorecase = true
        precomposeunicode = true
[remote "origin"]
        url = https://github.com/flutter/flutter.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "stable"]
        remote = origin
        merge = refs/heads/stable
[branch "beta"]
        remote = origin
        merge = refs/heads/beta

もしかしてfetchの設定かも?

[remote "origin"]
        url = https://github.com/flutter/flutter.git
        # fetch = +refs/heads/stable:refs/remotes/origin/stable
        # こうする
        fetch = +refs/heads/*:refs/remotes/origin/*