git clean什么也不做

5

我正试图清理我的工作目录,但是当我输入git clean --force时,没有任何反应。

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        packages/Microsoft.AspNet.WebPages.2.0.30506.0/
        packages/Microsoft.Data.Edm.5.2.0/
        packages/Microsoft.Data.OData.5.2.0/
        packages/Microsoft.Net.Http.2.0.20710.0/
        packages/Microsoft.Web.Infrastructure.1.0.0.0/

nothing added to commit but untracked files present (use "git add" to track)

$ git clean  --force

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        packages/Microsoft.AspNet.WebPages.2.0.30506.0/
        packages/Microsoft.Data.Edm.5.2.0/
        packages/Microsoft.Data.OData.5.2.0/
        packages/Microsoft.Net.Http.2.0.20710.0/
        packages/Microsoft.Web.Infrastructure.1.0.0.0/

nothing added to commit but untracked files present (use "git add" to track)

同样地,git clean -i也没有任何效果。

1个回答

9
这些都是目录,要删除目录,需要使用以下命令:
git clean -f -d

感谢这个答案的帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接