LOST ALL FILES! github source control

After 1 year of work… this afternoon I tried to use GitHub and trasnfer all files… the push to the master branch didn’t work… github deleted all my files on hardisk… and they aren’t in my repository… on github app desktop I still have to push the files. there is a portion of the files… not all… so where are my files?

It is very unlikely that you’ve lost your work - unless you specifically deleted things, your work should be recoverable.

There is a difference between “git” and “github” - “git” is the tool that is used for version control. “GitHub” is an online cloud service that can back up your version-controlled data.

as a starting point, can you post the output of “git reflog”?

Additionally: do you recall when you last committed to your git repository? Are you doing so via a gui or a command line?


So there were some Changes on Github Desktop I was able to recover this morning. So half of the work is safe. But yesterday, to avoid further problems, I DISCARDED the other Changes and so the other half of files. There is any way to recover the DISCARDED CHANGES?

Perhaps. Can you please provide the output of “git reflog”?

I don’t know where to find it, but searching the internet i find that the reflog is referred to a branch, so for the master branch I found this log:

0000000000000000000000000000000000000000 d0717e24de48de5bec77f54d5d188285c6c20323 Marco0123456789 <marcolaterza@live.it> 1623770298 +0200	commit (initial): Submitted
d0717e24de48de5bec77f54d5d188285c6c20323 bf49e0e880e454b0d2e6e6f83a51cf1d73fc7d1d Marco0123456789 <marcolaterza@live.it> 1623779674 +0200	revert: Revert "Submitted"
bf49e0e880e454b0d2e6e6f83a51cf1d73fc7d1d d0717e24de48de5bec77f54d5d188285c6c20323 Marco0123456789 <marcolaterza@live.it> 1623784768 +0200	reset: moving to d0717e24de48de5bec77f54d5d188285c6c20323
d0717e24de48de5bec77f54d5d188285c6c20323 247f8c41ecf9510b66cadd64de33d6a366d3bceb Marco0123456789 <marcolaterza@live.it> 1623784798 +0200	commit: Revert "Submitted"
247f8c41ecf9510b66cadd64de33d6a366d3bceb bb139949f42f0195fd03e887d14a26547458314a Marco0123456789 <marcolaterza@live.it> 1623841831 +0200	revert: Revert "Revert "Submitted""

Is this what you wanted or something else?

Thanks for the help btw!

no problem.

Hm, this looks a bit helpful. Let me ask you this - how do you use git? Do you use a gui? Or cmd.exe? Or something else? Can you walk me through step-by-step how you would commit new changes to your git repository?

I just installed the program yesterday, I use the desktop app, so I use the gui.
The steps I did from the beginning:

-half of the files of the project appeared as changes in the gui (idk why just half and not all files, maybe as more then 10.000 file in total)
-cause i’m not expert on github, I submitted to the Master the changes
-I tried to push the changes to the repository but cause some files where too large (level files), it didn’t work
-Meantime all other files where seen as Changes, but seeng that the push didn’t work, I decided to DISCARD the new half of the Changes, I didn’t know what I was doing… I thought I was just deleting from the interface, not from the disk
-To avoid further problems, I revert the FIRST pushed committed and so the first half of the file are now come back to te local disk
-Yesterday was late night and so I decided to go to sleep…
-Today I discover that DISCARDED CHANGES delete files also from hardisk

I read that there ayre tranferred to the RecycleBin but here there is nothing about my UE4 files.

NOW: DISCARDED CHANGES files are destroyed forever? Or is there a place where they are?

Ok, try this:

edit - dang I can only upload one image at a time. See this screenshot:

I was unable to capture the output from git log, but hopefully you get the picture (HAH! get it? “picture”? lol so funny)

We need to verify if you ever committed any of your changes.

Based on this data , I can help you figure out if we can recover your lost data.

Hey man, sorry but I had to told that i used GITHUB, not GIT UI.

BTW I opened GIT UI, selected the .git directorty and this message appeared

Are these the lost files?? Have I to click on YES?

EDIT: using a file recovery program, in the RECYCLE BIN of my hardisk, it seems I find the .uasset… but they are renamed… look. EDIT2: they also aren’t all, just 1000 file or more, while GIT found about 9000 loose objects

EDIT3: through the bash I got this:

bb13994 (HEAD -> master) HEAD@{0}: revert: Revert "Revert "Submitted""
247f8c4 HEAD@{1}: checkout: moving from main to master
6380380 (origin/main, main) HEAD@{2}: checkout: moving from master to main
247f8c4 HEAD@{3}: reset: moving to HEAD
247f8c4 HEAD@{4}: checkout: moving from main to master
79c94ec HEAD@{5}: checkout: moving from master to main
247f8c4 HEAD@{6}: checkout: moving from main to master
79c94ec HEAD@{7}: checkout: moving from master to main
247f8c4 HEAD@{8}: commit: Revert "Submitted"
d0717e2 HEAD@{9}: reset: moving to d0717e24de48de5bec77f54d5d188285c6c20323
bf49e0e HEAD@{10}: reset: moving to HEAD
bf49e0e HEAD@{11}: revert: Revert "Submitted"
d0717e2 HEAD@{12}: commit (initial): Submitted

But first tell me if I have to click on YES or NO in the GUI INTERFACE box.

This is neither hurting nor helping you - it has nothing to do with the lost data.

You should hit yes.

It looks like the github gui has been used to:

  1. Create an initial commit, with commit message “Submitted”
  2. Revert that commit (why)
  3. Checkout from “master” to “main” a bunch of stuff
  4. revert the revert from step 2 (why?)

At this point, I would try “git reset --hard d0717e2”…it looks like you tried this at some point (or maybe the github gui did?).

This will reset the repository to whatever state it was in when you made your first commit.

Are you sure that all the files you’re concerned with were added to the repository with “git add”?

You may want to make a backup of this folder before proceeding further - especially if you plan to try to recover stuff from the recycling bin, the backup will contain the current state as-is so that you can try further operations using git.

Let me say that nothing has been sent to repository, everytime I committed something an error occurred (some files were too large). So Repository has always been empty.

I revert the Steps because, as I told in the previous lines, the operation didn’t work so I thought to made some steps back.

At this point, does “git reset” make sense? Nothing was in the remote repository.

Discard changes synchronize your disk with the repo, if the file is different, step on the one in the repo, if a file does not exist in the repo, delete it (bin).
If you have not uploaded the files and you make a discard changes, it deletes all the files.
And if after that you cleaned the bin, well I’m pretty sure you’ve lost the files, but I’d like to be wrong

Well yeah, maybe I cleaned the bin. I don’t remember exactly. That’s why with the recovery program I found some files in the bin. But not all. So of sure they are lost…