git pull: keeps telling me to stash local changes before pulling

后端 未结 2 719
情歌与酒
情歌与酒 2021-02-03 12:27

When I am trying to pull my git repository with \"git pull\", it keeps telling me that I have local changes although I have not touched any of the mentioned files. Can someone e

2条回答
  •  时光说笑
    2021-02-03 13:25

    It sounds like your local branch does not have all of the changes on origin.

    Firstly, stash your changes

    git stash
    

    Then, pull in the changes from origin.

    git fetch origin && git rebase origin/(branch name)
    

    Next, add the stash back in to your working directory:

    git stash pop
    

提交回复
热议问题