“未跟踪的工作树文件” - 我如何才能中止所有更改?

时间:2017-10-11 00:19:33

标签: git

基于this answer,我尝试了以下命令的不同组合,最后我按照这个顺序尝试了所有这些命令:

sbees@STRIX-SCOTT D:\pathtorepo
> git clean -f

sbees@STRIX-SCOTT D:\pathtorepo
> git clean -fd

sbees@STRIX-SCOTT D:\pathtorepo
> git reset

sbees@STRIX-SCOTT D:\pathtorepo
> git checkout .

仍然收到错误:

sbees@STRIX-SCOTT D:\pathtorepo
> git pull
error: The following untracked working tree files would be overwritten by merge:
        MyProj.DynamicLoading/NetworkMessaging/NetworkMessaging.csproj
        MyProj.DynamicLoading/MyProj.DynamicLoading.Data.Objects/MyProj.DynamicLoading.Data.Objects.csproj
        MyProj.DynamicLoading/MyProj.DynamicLoading.Data/MyProj.DynamicLoading.Data.csproj
        MyProj.DynamicLoading/MyProj.DynamicLoading.sln
        MyProj.DynamicLoading/MyProj.DynamicLoading/MyProj.DynamicLoading.csproj
Please move or remove them before you merge.
Aborting

sbees@STRIX-SCOTT D:\pathtorepo
>

我怎样才能从远程分支更新项目并完全忽略我所有的本地更改?我现在刚刚删除并重新启动,但它是一个8 gig项目,下载需要5个小时......

什么是神奇的咒语?我需要找一只鸡吗?

sbees@STRIX-SCOTT D:\project
> git reset --hard origin/master
Checking out files: 100% (1179/1179), done.
HEAD is now at ea4b3238 Merge remote-tracking branch 'origin/master'

sbees@STRIX-SCOTT D:\project
> git pull
error: The following untracked working tree files would be overwritten by merge:
        Assets/AIBots/Man_Office_01/resources.meta
        Assets/AIBots/Man_Office_01/resources/Man_Office_01.fbm.meta
        Assets/AIBots/Man_Office_01/resources/Man_Office_01.fbm/Man_Office_01_Beard_diffuse.png
        Assets/AIBots/Man_Office_01/resources/Man_Office_01.fbm/Man_Office_01_Beard_diffuse.png.meta
        ... about a thousand more

2 个答案:

答案 0 :(得分:0)

你可以这样做:

$ git add .
$ git reset --hard HEAD

现在,试试git pull

答案 1 :(得分:0)

所以经过1小时的git命令后,我下载了Aurees Git Client,打开它,点击了大橙色"回滚更改"主屏幕上的按钮然后我就能拉...