After a recent git commit and sync, my project got corrupted and it is not building. Please see the screenshot.
Can somebody please help.
Regards
Let's name the corrupted workspace is "corruptWorkspace" and the workspace to be fixed on is "fixWorkspace" First step you need to do is create a new workspace to do your recovery and copy the object and refs:
$ mkdir fixWorkspace
$ cd fixWorkspace
$ git init
$ cp ../corruptWorkspace/.git/objects .git -r -a
$ cp ../corruptWorkspace/.git/refs .git -r -a
From here you can recover a branch/commit.
Find the branch you want to recover by finding it in .git\refs\heads or in .git\logs\HEAD file Open in a text editor and you will find the last commit SHA for that branch in the branch file or the second SHA column of your last record for the branch in the HEAD file This command should be readable and show the last commit changes
$ git show [commit SHA]
After confirming that the branch looks ok, try to check it out
$ git checkout [branch name]
Then you can reset the branch
$ git reset --hard
At this point you have the latest committed version of your branch. The next step is to recover the stash file.
Find the stash you want to recover by finding it in .git\refs\stash or in .git\logs\stash file
Open in a text editor and you will find the last commit SHA for that stash in the stash file or the second SHA column of your last stash record for the branch in the stash file List the files that are in the stash for you to recover, from here you can get the location and file that were stashed to be used for restoring the file
$ git show --name-only [stash SHA]
Recover the stashed files
$ git show [stash SHA]:[full path of file] > [full path of file]
After you've done the above command for all your stashed files, you have finished getting your branch and your stashed file. if the config file is not corrupted, you might even be able to copy the "origin" definition and push your changes.