git status没有提交任何内容,但无法切换分支

时间:2017-11-27 06:30:31

标签: git branch git-commit git-checkout nothing

我在Windows上工作,感谢git专业人士提供的任何帮助。

PS G:\Solid\WebPortals> git status

On branch pos-event-waiver
nothing to commit, working tree clean
PS G:\Solid\WebPortals> git checkout pos-exchange-bill
error: Your local changes to the following files would be overwritten by checkout:
        Site/WebPortals/assets/typescript/pos/cart/waiver.component.ts
Please commit your changes or stash them before you switch branches.
Aborting

enter image description here

1 个答案:

答案 0 :(得分:0)

您的本地分支pos-event-waiver可能未设置为跟踪远程分支。要修复此问题并跟踪主分支,请执行以下操作:

git branch --set-upstream-to origin/master

立即尝试git status获取当前分支的状态,然后根据需要提交或存储更改。