Git asks me to commit or stash changes on checkout master, even though all changes were committed?

前端 未结 8 1765
误落风尘
误落风尘 2020-12-28 12:48

I have two branches locally, master and Berislav. The latter is currently active, and I have committed all the changes. When I try to checkout to <

8条回答
  •  悲哀的现实
    2020-12-28 13:05

    I encountered a similar problem today. git status wasn't listing the files which checkout was complaining about. I did a:

    git checkout -- path/to/file
    

    And that undoes any changes to the file.

    An even easier way to undo all unstaged changes on current working directory [1]:

    git checkout -- .
    

    [1] - Be warned - you will lose any other unstaged changes you were working on (if any). If you don't know what you are doing, then keep a backup of the files you were working on :)

提交回复
热议问题