r/git • u/Just_Ad_5939 • 2d ago
A video file I couldn't include in the commits because it was too large, is now gone as of turning on my computer.
I was putting a school project in a github repository so i could sync my laptop and pc and have the same files on both, but the video was too large so every time it would be included i'd have to hit 'discard changes' on that on the github desktop app.
now the issue i'm having is that when I turned on my computer and opened up the files for the project, the video was gone. I have no idea how this happened as.. well it was there last time I had the computer on im pretty sure. or at least last time i was using those files.
The video isn't in my trash either btw. Im also using linux mint.
so.. i had a similar issue yesterday but was able to resolve it by using $ git reset --keep HEAD@{3} but after i got that fixed i ran into issues again because there were other things I still needed in that repo so i pulled again and the video disappeared again i think. so i did it again and then copied the video to make sure it was safe, then i cloned the repo into the thing again, merging all the files together. the video was in there and so i deleted the copy.
...i think it might be because I merged the folder yesterday? did.. did git like.. replace the folder when i turned on my computer today instead of merging the folder? why was git even doing anything @w@
please help. i need that video and have no idea why its gone or where it went.
3
u/realmauer01 2d ago
Hard to say what happened, if git did anything it happened when you merged yesterday and not today. You must have a version of the file somewhere left, either aparently in a previous commit on a different branch or on whatever computer you are synching this with.
1
u/Just_Ad_5939 2d ago
ok yeah i figured out that im just fucked and am gonna need to remake the video.
*sigh*
1
u/lajawi 2d ago
I think you need to learn more about Git, how to use it, and what it’s for.
Generally you don’t want to commit big binary files, and it’s not designed a syncing service either. For that you’d use services like NextCloud, Sync etc.
2
u/RobotJonesDad 2d ago
You said that you never committed the file? Do you literally mean you never added it, committed, or pushed? A failed push is completely different from neverreflection.
The most important thing at the moment is to not run random git commands, especially in a gui!
Even an add has your local git make a copy of the file.
Try:
That will look for the file in the reflog.
will show if you stashed changes at some point.
You can also try:
We are at this point hoping you got git to make a copy before you presumably gave it permission to throw away untracked changes.
1
u/AnmolSethiDev 1d ago
Git can't bring back a file it never tracked. It was never committed, so there is nothing in the history or the reflog to restore. That points away from git as the cause.
Two things to check. In GitHub Desktop, "Discard changes" on a new, untracked file removes it from the folder, so the daily discard may be what deleted it. And you sync a laptop and a PC, so the other machine may still have the video.
To stop it happening, put the file name in .gitignore. Then it never shows up as a change you have to discard. For big files you do want in the repo, look at Git LFS.