I have accidentally deleted my commits on pythonanywhere.com and now I see very old state of my files. My Django website isn't working at all.
What I did:
$ git reset --hard HEAD~1
And then:
$ git push --force
That was big mistake. I deleted commits from remote as well. What I wanted to do to fix it:
git reflog
And then use:
git reset --hard <sha value>
Unfortunately, bash console returned following error:
fatal: unable to write new index file
and then I have discovered that I am run out of space on my pythonanywhere account. It is strange, because before commits I had about 80% of used space, and now I have 100%. Is this the reason why I cannot use git reset command? I deleted single file to free up the space, but still it is telling me that space is 100% used. Now I see old version of my Django project, it never took up so much space.
What can I do to restore previous state of my files?
First, as documented in pythonanywhere Disk Quota, check what is using up all your space:
Try and clean up as many files as possible, before attempting your
git reset --hard <sha value>.For instance, try also, to gain space, to "clear my local working directory" (assuming your current files are not the ones you want):
The
.localfolder is not generated by Django itself.It is a folder created by the
pippackage manager when installing packages with the--userflag.It is used to store user-specific packages and configurations.
You can safely delete it if you don’t need the packages installed in it anymore.
However, if you are still using the packages installed in it, you should not delete it.
In your case: delete it in order to get some free space and make your commit, then re-create it with your project build process, which will trigger the re-installation of the missing dependencies.