git status 没有说要提交,但无法切换分支

问题描述 投票:0回答:1

我正在 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

git branch git-commit git-checkout
1个回答
0
投票

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

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

立即尝试

git status
获取当前分支的状态,然后您可以根据需要提交或存储更改。

© www.soinside.com 2019 - 2024. All rights reserved.