Why does updating Oh My Zsh give me an error about rebasing with unstaged changes?

I opened a terminal window and Oh My Zsh wanted to check for updates. I entered Y for yes and then I got the error message:

Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.

I tried git status and Git told me that the current directory wasn't a repository (which didn't surprise me).

So, what is it complaining about?


Solution 1:

You made a changes to the config files probably. Go to your oh-my-zsh directory and type in git status.

Results for me (i've changed one of the themes):

╭─ jane  ~
╰─ λ cd .oh-my-zsh                                                      1:57:10
╭─ jane  ~/.oh-my-zsh  ‹master*›
╰─ λ git status                                                         1:57:17
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:   themes/bira.zsh-theme

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

You will see that some files have been modified.

You can type in git stash to temporarily get rid of those changes, and attempt updating again.

Solution 2:

Here is what I had to do to fix it:

cd ~/.oh-my-zsh/
git add .
git commit -m "commit message"
upgrade_oh_my_zsh

Don't forget the "." at the end of 2nd line

Solution 3:

Oneliner solution

cd "$ZSH" && git stash && upgrade_oh_my_zsh && git stash pop
  1. cd "$ZSH" change tu current ZSH directory.
  2. git stash stage your local changes and head back to master via git.
  3. upgrade_oh_my_zsh upgrade ohMyZsh
  4. git stash pop to keep the changes, probably your themes.