我有一个 git 存储库。它有 A B C D E ... 提交。现在我想将 D checkout 为一个名为 Dbranch 的新分支。所以我执行: git checkout D -b Dbranch 。现在我想删除这个分支。首先我需要切换到 master 分支,然后使用 git branch -d Dbranch 删除它。但是当我执行 git checkout master 时,它给了我错误。

error: The following untracked working tree files would be overwritten by checkout:
    source/a/foo.c
        ...... (too many lines)
Please move or remove them before you can switch branches.
Aborting

如何删除Dbranch?

最佳答案

尝试 git checkout -f master
-f--force
来源:https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html

关于git checkout 主错误 : the following untracked working tree files would be overwritten by checkout,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/17989165/

10-13 05:50