Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Recovering Terrain asset from Git blob field

Discussion in 'Editor & General Support' started by Tymac, Jul 20, 2022.

  1. Tymac

    Tymac

    Joined:
    Nov 12, 2015
    Posts:
    10
    I accidentally committed a large zip file to Git which broke my source control. Stupidly, I continued to work on my project by manually backing up files to another hard drive. When I finally went to fix the local staging commit I ended up deleting the commit which had the unexpected result of deleting all files from my project preceding the date this commit was created.

    I was able to recover most of my files from my manual backups but I'm missing a handful of terrain files that I was able to restore using Git fsch, Git cat-file and then Git Show [hash-id] > terrainassetfile. This was awesome because I thought it would save me days of lost work and the frustration of reproducing these files.

    My problem is that I created these files but Unity does not recognize them. I have no idea how to import them back into the project and restore them as terrainname.asset files that Unity Editor would place back in the asset database. Any thoughts on how I could properly convert the Git blob files to recognizable unity assets? btw, using Git restore branch I don't think is an option because it would put me back into the same situation I was in before, and I've since done other commits and I'm fearful of compounding the issue and deleting changes to my project since fixing it.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    I believe the git blob files are just gzipped or bzipped or something.

    Your best best for fixing over-committing a large file is to catch it as soon as possible, then just rebase around the mis-commit.
     
    Tymac likes this.
  3. Tymac

    Tymac

    Joined:
    Nov 12, 2015
    Posts:
    10
    I appreciate the response Kurt and it certainly is good advice that I know better for the next time I make such a mistake. I'm hoping a Unity moderator could point me in the right direction on how I could go about restoring a git blob to a terrain asset file. All of the data is there, Unity just doesn't recognize it.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,711
    If your description is accurate, he problem has absolutely nothing to do with Unity and has everything to do with how git stores content in its content addressable filesystem.

    You'd have better luck finding a git person, or just looking into git docs yourself. As I said, I believe it is simply compressed data, so you just have to uncompress it properly.