Git不允许我切换分支,说:您对以下文件的本地更改将被签出覆盖

时间:2019-02-28 06:24:26

标签: git

我在StackOverflow上搜索了类似的问题,但似乎总是有人试图从其分支机构升级为master。对我来说恰恰相反。我在master上,试图结帐到已经推送的分支。

当我这样做时:

git checkout mybranch

我得到:

error: Your local changes to the following files would be overwritten by checkout:
    db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting

我尝试过:

git checkout -f mybranch

但我收到消息:

error: Entry 'db/structure.sql' not uptodate. Cannot merge.

如果我尝试隐藏或提交,则没有区别:

git stash
No local changes to save

git checkout mybranch
error: Your local changes to the following files would be overwritten by checkout:
    db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting

git commit
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

git checkout mybranch
error: Your local changes to the following files would be overwritten by checkout:
    db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting

git submodule status不返回任何内容,而git status -u返回:

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

有关如何解决此问题的任何建议?

0 个答案:

没有答案