Git stash: “Cannot apply to a dirty working tree, please stage your changes”

后端 未结 11 1675
青春惊慌失措
青春惊慌失措 2020-12-12 09:04

I am trying to apply changes I stashed earlier with git stash pop and get the message:

Cannot apply to a dirty working tree, please stage your c         


        
11条回答
  •  孤城傲影
    2020-12-12 09:30

    You have files that have been modified but not committed. Either:

    git reset --hard HEAD (to bring everything back to HEAD)
    

    or, if you want to save your changes:

    git checkout -b new_branch
    git add ...
    git commit
    git checkout -b old_branch
    git stash pop
    

提交回复
热议问题