Weird Error on git where I cannot commit anything anymore

Hi there,
So yesterday I commited and pushed a build where a build-error could be seen (forgot a ‘;’ character at the end of a line). Today I woke up and wanted to fix the error, but when I would open the project4 folder on git, the git-path would look weird and the command lines I’m used to using would not work:
image
Now I looked online, and found out my index file has been probably corrupted. Not really thinking about it, I input the command

rm .git/index

Now, git status works, but tells me that every single file of project4 has to be commited again. And trying to commit gives me this error message:
image

I don’t exactly know what to do now, I hope you can help me and that I can push and commit again!
My java files do still work though and I can continue working on the project, only git is failing.

Seems like your git project was corrupted, as you already said. This was already sometimes the case during the last projects for some people. The best solution would be: backup changed but not-pushed files, clone the project feshly from the server, add your backuped changes again in your freshly cloned files, commit and push it.

This should do the trick.

(reference: Problem with Git, [ref: re...] - #2 by johannes)

3 Likes

Thank you for the quick response :hearts: