[Solved] Git pull error: cannot pull with rebase: Your index contains uncommitted changes.

Git pull reports an error
error: cannot pull with rebase: your index contains uncommitted changes.
error: Please commit or stage them

 

Solution:

1. Execute
git stash first

2. Then execute
git pull rebase

3. Finally, execute
git stash pop


Remember to git stash pop after git stash, otherwise the code will be lost

Git stash: # can be used to temporarily store work in progress
git stash Pop: # read the last saved content from git stack

Read More: