Every Single Object "Missing Prefab" after Git Revert

tl;dr I did a code revert and now every single prefab in my scene says “Missing Prefab” in red and my whole project is shot.


Long version:

*Worked on my project for a while on my Macbook. Everything running fine.

*Did a commit from Sourcetree to github.

*Moved to desktop. Did a pull request from github via Sourcetree. Everything working fine.

*Wrote some code and made some changes that didn’t work out. Oh well.

*Went to Sourcetree. Found last commit I wanted. Right clicked and chose “Reset current branch to this commit.” Chose "Hard reset.


Outcome:

*Every game object in every scene is now just a “Missing Prefab” if it was a prefab on my PC. On my Macbook everything is fine.


Things I’ve tried to fix it:

*Asset reimport.

*Making sure editor is set to have visible meta files and text mode forced (it was the whole time)

*Deleting Library file

*Redownloading the entire stupid thing from git repo

*Making sure gitignore wasn’t ignoring .meta files (it wasn’t)


Even after redownloading the entire project, every prefab reference is still broken. I literally can’t even work on my game at my PC now. Any advice much appreciated. I don’t know what the hell is going on, but I’m at a complete standstill and I’ve been trying to fix this for hours. Thanks.

I had a similar issue. My solution is the following:


  1. Close Unity
  2. Delete All Project files in your Repo (but .git)
  3. In Terminal: git reflog
  4. And then: git reset --hard <hash of your last commit>

I hope this works for you as well :wink: