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

7

1

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?

n8mob

Posted 2015-06-03T15:30:49.610

Reputation: 223

You made a changes to the config files probably. go to your oh-my-zsh directory and type in git status. 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. – mnmnc – 2015-06-03T15:31:25.313

That's exactly what happened. Will you make your comment an answer and I'll mark it? – n8mob – 2015-06-03T15:34:43.940

Sure, I've just posted an answer. – mnmnc – 2015-06-05T00:00:00.030

Answers

5

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.

mnmnc

Posted 2015-06-03T15:30:49.610

Reputation: 3 637

1

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

Stryker

Posted 2015-06-03T15:30:49.610

Reputation: 141

Does that allow you to keep your changes, or does the oh-my-zsh update overwrite with them? Or does it not matter because your changes didn't conflict? (Or something weirder?) – n8mob – 2017-05-23T22:16:35.423

0

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.

Exequiel Barrirero

Posted 2015-06-03T15:30:49.610

Reputation: 101