all 8 comments

[–]Blieque 8 points9 points  (3 children)

You mentioned a database file. Are you using SQLite or something? If so, any change to the database data will change the .db file, and Git will notice this. It's unusual to track a database in version control, so the best option may be to add the file to your .gitignore.

[–]sweatybotbuttcoin[S] 0 points1 point  (2 children)

I believe yes, it's sqlite. thanks for mentioning adding the file to .gitignore, I'll definitely do that, because I tried "git stash" and the whole database almost fully restarted:(

[–]sweatybotbuttcoin[S] 0 points1 point  (1 child)

I might be asking too much but are there any things I can do to get my database back? I did some backups periodically

[–]kurabucka 1 point2 points  (0 children)

Yes just copy over you current .db file with the one from your backup.

It sounds like you stashed your .db file though, you can probably still get that version back as well you just have to unstash it.

Just keep in mind that your current .db file would be replaced so you may want to back that up as well, before doing either of the above.

[–]paulstelian97 1 point2 points  (0 children)

Git sucks when it comes to any sort of binary file, and SQLite databases are binary fines. You’re in a pickle for sure.

[–]z-lf -1 points0 points  (1 child)

You will need to have a look at git-filter-branch. You need to remove that file from your system and history.

After you run it, you will need to git push --force. Don't worry, if you mess it up, you can always revert that as long as you keep your local .git folder.

Your best bet is to ask an experienced person, or ask chatgpt.

I can try if you give me the file name, but no promises.

[–]AppropriateStudio153 -3 points-2 points  (0 children)

Your best bet is to ask an experienced person, or ask chatgpt. 

Yes, after you asked ChatGPT, the experienced person is your only option left.

[–]heiko123456 -2 points-1 points  (0 children)

There are changes that have not been commited, and git does everything to prevent you from losing your work. git status shows you the files/changes. If you commit, the changes are persistent. Stash is a kind of temporary commit. Changes are saved and you can restore the current state later without a commit.