Unity Scene Files Disappeared After Using Git Push and Rebase #206238
🏷️ Discussion TypeBug Hello, I need help with a serious problem that happened while I was uploading my Unity project to GitHub using Terminal. I was using Git commands to push my project to GitHub, and during the process I also encountered problems involving rebasing and merge conflicts. After completing some of these commands, I discovered that files and work inside my Unity scene had disappeared. The project files are very important to me, and I am worried that I may have accidentally deleted or overwritten my work while using Git. Is there any way to recover the missing Unity scene files or restore a previous version of my project using GitHub history, Git reflog, or files from my local Mac? I would really appreciate any help or advice on how I can recover my lost work. Thank you. |
Replies: 2 comments 2 replies
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
Hi @JeongwonKim-kr , Don't panic — Git records almost everything, and even if files are gone from your working directory, they're likely still in Git history somewhere. A few recovery steps in order: First, check your reflog — this shows every HEAD movement Git made, including rebases and resets: git reflogYou'll see a list of commits/operations with timestamps. Find the one right before things went wrong. If you see something like Reset to the commit before the problem: git reset --hard abc1234This restores your working directory to that point. If this gets your files back, you're done — just be more careful with the next rebase/merge. If reflog doesn't show it, check all branches and the stash: git log --oneline --all --graph
git stash listYour files might be on a different branch, or stashed. If you see them in stash: Check .gitignore — if you're using the default Unity If none of that works — the files were actually deleted in a commit — you can still recover them: git log --diff-filter=D --summary | grep deleteThis shows deleted files. Find your scene file, then: git checkout abc1234^ -- path/to/your/scene.unityReplace For the future: commit more frequently, use branches for risky operations (rebase on a test branch first), and keep your local working directory as a backup until you're confident in Git's state. |
Hi @JeongwonKim-kr ,
Don't panic — Git records almost everything, and even if files are gone from your working directory, they're likely still in Git history somewhere. A few recovery steps in order:
First, check your reflog — this shows every HEAD movement Git made, including rebases and resets:
You'll see a list of commits/operations with timestamps. Find the one right before things went wrong. If you see something like
rebase: continuingorreset, that's likely where your files went. Note the commit hash (e.g.,abc1234).Reset to the commit before the problem:
This restores your working directory to that point. If this gets your files back, you're do…