しふみんのブログ

しふみんのブログです。

Oh-My-Zshをアップデートできない問題

問題

Oh-My-Zshをアップデートしようとすると以下のエラーメッセージが出て、アップデートできなくなりました。

$ upgrade_oh_my_zsh
Upgrading Oh My Zsh
Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.
There was an error updating. Try again later?

解決方法

Can't update using upgrade_oh_my_zsh · Issue #1991 · robbyrussell/oh-my-zsh · GitHub
によると、
.oh_my_zshディレクトリ以下のリポジトリの変更をコミットすれば直るらしい。
(後々冷静にエラーメッセージを見たら、「変更点があってrebaseしてpullできないからcommitするかstashして」って書いてあったけど、問題発生時にはよく分からなかった)

git statusで確認すると、

$ cd ~/.oh_my_zsh
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   custom/example.zsh

no changes added to commit (use "git add" and/or "git commit -a")

custom/example.zshに変更点があるっぽい。
(イジった記憶なし)

というわけで、変更をコミットすると、

$ cd ~/.oh_my_zsh
$ git add .
$ git commit -m "適当なコミットメッセージ"
$ upgrade_oh_my_zsh

Oh-My-Zshをアップデートできるようになりました。

参考サイト

github.com