Defold and Github killed my game

I tried backing up my project on gitHub and defold crashed and “reverted”.
All was fine. I just tried again, and it did a pull from Github and took my project back 5 months.
I lost sooo much source code, image files and edits. I feel like just giving up…

I am using 1.9.5, as I updated from 1.9.1. That is how far back it went. Not sure if this is a bug or not.

I’m terribly sorry. That’s a real gut punch. Did you make commits during those five months? If so, it’s most likely possible to recover the lost commits. Commits that do not belong to any branch in Git (meaning, you can’t see them) will still exist in the repository for some time. You can list these with git reflog, and from there recover them by creating a new branch that points to one of them. See this StackOverflow answer: https://stackoverflow.com/a/34751908/8034688

Edit: here’s a more detailed explanation of references in Git and how reflog works: Recovering lost commits with git reflog - Thomas Belin

I hope it will help you recover your files.

1 Like

Part of getting the most out of github is frequently identifying when your code is at a good restore point and committing it. It takes a while to develop good commit habits. Part of what leads to it is having disasters that set you back. Pretty much everyone learns the hard way. Hopefully you have some commits saved that you don’t realize can be restored.

2 Likes

Gonna check and see. One commit was lost

1 Like

Okay, I found a commit from 12/3/2024. Still missing some new stuff, but I suppose I can redo it.

2 Likes

Great to hear. Hopefully it won’t take too long to redo the last day’s work.

Ugh!
The files I lost after clicking ‘pull’ were omitted from Defold’s changed files list. All those files, new files, were deleted. Why would any software delete files from my folder without asking? DANG IT!

Terribly sorry to hear that. There might exist a git stash in your repository with the state of the working directory how it was before the sync with GitHub.

Thanks for the input. I did find one close enough, now I am just trying to remember all that I did after. I am getting there. Thanks.

THIS! Don’t be afraid of creating feature branches with the stuff you are currently working on and commit often. Then squash the commits when you merge back to your main development branch to not clutter it with a bunch of dev commits.

2 Likes

I usually commit twice a week. But for some reason, Defold did not detect my changed files.

This has happened to me twice. I only noticed when I was trying to bundle a project and realized that defold was referencing an older version of the script. I then closed defold just to see the file revert back.

I do have a question, had you closed the Defold app at all during this time? Or did you leave it running on your device? I have a hypothesis that leaving Defold running (therefore allowing it to use up more and more memory over time) causes this issue, but I have no proof for this.

This is a Defold issue by the way; GitHub can’t push be use Defold isn’t flushing the files so git can’t see changes

1 Like

It happened to me once as well. That time I had uncommitted changes when I did an editor update.
Fortunately it was a minimal loss but I also could not reproduce it.

It goes without saying that I now commit before updating, and that’s in general good practice.

1 Like

I do leave it running. Maybe a side effect.

I commit every time I do something and my brains goes, “okay it works.”
Sometimes you even do it before the thing fully works, just before you’re about to start something that you don’t know if it will work.

At first it seems like you spend a lot of time logging everything you did but it eventually becomes second nature and saves you a lot of time when you need to be able to comb back through the history.

1 Like

Also would be a good idea to periodically check that everything is actually being committed, as if the files aren’t on your computer git won’t get it. When I had his issue I assumed that Defold simply kept the fies in its memory for one reason or another. It’s weird cuz the 2 times it happened to me I was trying to bundle and it was stuck back at a specific time where there was an error in a script that no longer exists, but the compiler says there’s an error cuz it’s reading from the file that wasn’t updated

1 Like

We’ll soon remove the push/pull functionality of this feature, and only keep the “changes” part.
We’ve added tickets for this.

What’s the resoning for that? I find it quite convenient.

The reasoning is that it occasionally seems to trip up, and not work as the users expect.
At the same time, there are much better tools out there, and we’d rather defer to their workflows.

E.g. we wouldn’t add an image editing tool in our editor, there’s Krita and Photoshop for that.
Similarly, there are tools dedicated for source control.

4 Likes

That makes sense. What does the “keep the changes part” refer to? Just the list of changed files with the diff?

1 Like