Github files got overwritten #22130
-
Hello! I’m a student and due to Coronavirus had to upload some simple scripts into my Github. So yesterday I had around 5 folders that had files in “skriptimine” repository. All that previous work was done at school. So I wanted to upload a new script to Github and for some reason it overwrote my repository (all my previous scripts got deleted). https://github.com/JanarGithub/skriptimine git add yl1 git commit -m “Hüpotenuus” #It shows "Praks5"on the image, I did git commit --amend command and pushed the upload again. Not sure why. After these commands the new yl1 file got uploaded and previous files got deleted. Can I somehow recover the deleted files? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I assume what happened is that you didn’t have the history of the work done at school on your home machine. When you use “-f” with “git push” it will overwrite any conflicting history, which is why the other work got overwritten. It is highly recommended not to use -f unless you have double checked it is necessary and the state and history are correct. In this situation I see only one thing you can do yourself: Get to the repository you used at school (or get a copy), and recover the work from there. Either merge the branches, or copy the files and make a new commit with them. You could also try asking Github support if they have a backup, but I have no idea about the chances. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for the reply! |
Beta Was this translation helpful? Give feedback.
-
Hello, if your data was overwritten, you can just use a data recovery tool to recover it. I have used Bitwar Data Recovery, and I think this tool is safe and efficient, you can also have a try if necessary. |
Beta Was this translation helpful? Give feedback.
I assume what happened is that you didn’t have the history of the work done at school on your home machine. When you use “-f” with “git push” it will overwrite any conflicting history, which is why the other work got overwritten. It is highly recommended not to use -f unless you have double checked it is necessary and the state and history are correct.
In this situation I see only one thing you can do yourself: Get to the repository you used at school (or get a copy), and recover the work from there. Either merge the branches, or copy the files and make a new commit with them.
You could also try asking Github support if they have a backup, but I have no idea about the chances.