0

Based on this answer, I tried different combinations of the following commands and lastly I tried all of them in this sequence:

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 .

And I still get errors:

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
>

How on earth can I just update the project from the remote branch and completely ignore all my local changes? I would have just deleted and started over by now, but it's an 8 gig project that took 5 hours to download...

What is the magic incantation? Do I need to find a chicken?


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
  • Try with visual studio closed? Your commands look correct – anthony sottile Oct 11 '17 at 00:23
  • It was Unity, after it finally closed I ran the commands again and one file still showed up. So I deleted it. Now pull gives me TONS of merge conflicts. So I did reset again and now I have like 80 of the "working tree file" messages again. This sucks so much. –  Oct 11 '17 at 00:37
  • Worth a shot if you're still stuck: `git reset --hard /` with `` checked out (e.g. `git reset --hard origin/master` on `master`). Note this throws out _all_ local changes and replaces completely with what's on the remote, so be sure you've backed up everything you need before you run it. – miqh Oct 11 '17 at 00:47
  • added results... –  Oct 11 '17 at 00:52

2 Answers2

1

You can do this:

$ git add .
$ git reset --hard HEAD

Now, try git pull

Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
0

So after literally 1 hour of git commands I downloaded Aurees Git Client, opened it, clicked the big orange "Rollback Changes" button on the main screen and I was then able to pull...

  • 1
    You probably wanted `git clean -dfx` back at the start, but who knows at this point (and who knows what their clicky button does either :-) )... – torek Oct 11 '17 at 02:10
  • I was having a similar issue as the asker: `git checkout` kept failing due to untracked working tree files, yet I tried all combinations of `git status` to see those files to no avail. Running `git clean -dn` to dry-run a cleaning *did* show those files (`-d` recursed without a path specified), similar to @torek's suggestion. In my case, I didn't need to keep those files, so use `git clean` with caution. :) – gigabot Dec 12 '22 at 19:18