r/git • • 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.

0 Upvotes

22 comments sorted by

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

the video was never commited though, and none of the commits include things saying to remove it

2

u/realmauer01 2d ago

The only thing thats git related that can kill of non tracked files is a git reset with the --hard option. That basically removes the entire folder and then checksout to the commit you specified.

You would need to try a windows scanner for deleted files to rescue that. Depends on a lot of factors but it might still be in time.

1

u/Just_Ad_5939 2d ago

mm.
you said windows scanner..
is there a linux version of that?

1

u/realmauer01 2d ago

Well linux definitly has their own.

1

u/Just_Ad_5939 2d ago

okay....
can you tell me what its calllleed...? or what the program is supposed to do so i can look for the linux version that does that?

1

u/realmauer01 2d ago

It litterly scans for deleted files. File systems dont delete files, when a file gets deleted they just mark the area as free to use. Software can scan through these free to use areas and reconstruct the files when they are not overwritten enough.

1

u/Just_Ad_5939 2d ago

ok so all of the stuff i could find for doing that either requires the file to be open(which it hasn't been since yesterday) or requires me to do stuff i cant do, like loading it onto another drive

1

u/realmauer01 2d ago edited 2d ago

That doesnt sound right.

What Filesystem are you using? Foremost might be working

1

u/Broad-Promise6954 ancient 2d ago

Even a hard reset doesn't affect any never-committed files, but git clean would, or who knows what any non-Git software will do.

1

u/Blinkinlincoln 2d ago

Ya vscode source control is a good visual that could help you find all your branches if you can't via terminal

1

u/Just_Ad_5939 2d ago

im not using vscode im looking for a video and there isnt even any text files, the rest of the stuff in the repo is just pictures

2

u/realmauer01 2d ago

They seem to use github desktop, which i have no experiance 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.

1

u/Just_Ad_5939 2d ago

I.. didn't commit the file though?
also.. im coming here to learn dude. if you dont wanna help then why are you telling me to come here for help? at that point just shut up and let someone else help?

1

u/lajawi 2d ago

You didn’t commit the video because the “syncing service” (GitHub) you were using doesn’t support it, making the “syncing service” you were using unviable for your needs.

Git is in the first place a version control system designed to make and keep snapshots (commits) of primarily text files, and makes it possible to go back in history and even branch off and co-develop and merge several features at once. It has a useful feature of pushing and pulling to and from remotes, that - with the right setup and tools - allows for collaboration and thus “syncing” to several PCs too, but it’s not its main purpose nor use. Did that help you?

1

u/realmauer01 2d ago

Ah people use github for all kinds of things, github actions can run minecraft servers.

I am just wondering how big the file must be for github to refuse it.

2

u/Just_Ad_5939 2d ago

over 100 MB and it is refused
it was an unedited video of ~199 MB

1

u/lajawi 2d ago

People using something one way doesn’t mean it’s intended nor designed to be used that way. Besides, running Minecraft servers on actions is very much against GitHub’s ToS.

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:

git log --all --reflog --oneline -- "*.mp4"

That will look for the file in the reflog.

git stash list

will show if you stashed changes at some point.

You can also try:

git cat-file --batch-all-objects --batch-check \
  | awk '$2 == "blob"' \
  | sort -k3,3nr \
  | head -20

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.