Error when changing to master branch: my local changes would be overwritten by checkout

后端 未结 6 1980
难免孤独
难免孤独 2020-11-30 19:20

This question is similar to this one, but more specific.

I have a project with two branches (staging and beta).

I develop

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 19:40

    I encountered the same problem and solved it by

    git checkout -f branch
    

    and its specification is rather clear.

    -f, --force

    When switching branches, proceed even if the index or the working tree differs from HEAD. This is used to throw away local changes.

    When checking out paths from the index, do not fail upon unmerged entries; instead, unmerged entries are ignored.

提交回复
热议问题