Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

What if git repository gets corrupted?

Writer Matthew Harrington

Git keeps track of every change you've made to your project. So it feels much safer to work on something knowing that, even if system crashes and current files you were working in get corrupted, there will still be the latest version you've commited in the .git folder. But what if some files in that folder get corrupted. Does git keep an extra backup of them as well?

I'm also curious how git handles writing to files. Does it create backups while writing for in case of a crash it can recover? Or does it just write directly to the files? I know git is open source, but the source code is too overwhelming for a beginner like me to understand...

7

1 Answer

This seems like common misconception about git.
Git is not backup solution.
You can use git to backup things and it (usually) work but there's no dedicated, fool-proof logic to prevent data loss on file corruption. You can (and arguably should) push your local files to some remote (which can be private) which would increase resilience to corruption - but that's it.
If you like versioning using Git and would like to read more on topic of backing it up you can check out Git Backup Guide

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy