GithubDesktop 错误:"The following untracked working tree files would be overwritten by checkout"

Error with GithubDesktop: "The following untracked working tree files would be overwritten by checkout"

我为我的项目创建了一个新分支,但是当我尝试切换到新分支时出现错误:

The following untracked working tree files would be overwritten by checkout

..基本上我所有的文件都在错误的描述中。

我在互联网上和本网站上找到的所有解决方案均无效。我什至尝试使用 git 并使用我看到的大多数主题中建议的命令,但其中 none 有效。我无法 force 结帐,我无法 clean 回购,我卡住了。

我唯一没有做的事情是尝试在 master 分支中 commit,但我不想这样做,因为这些文件还没有准备好推.

你知道我如何切换分支吗?

因此,我下载了 ToritoiseGit 并使用 "add" 函数将文件放入我的变更集中。这很有效,我现在可以使用任何其他软件切换到任何分支。

正确的做法是使用git stash push,然后切换到新分支并弹出您创建的存储。您首先需要添加更改。

像这样:

git add .
git stash push
git checkout newBranch
git stash pop