If a feature can lead to actual unintended data loss, it should come disabled by default. Are there any other "unsafe by default" features in Git? What would be a sane general default that prevents unwanted data loss, and why is it the case?
If a feature can lead to actual unintended data loss, it should come disabled by default. Are there any other "unsafe by default" features in Git? What would be a sane general default that prevents unwanted data loss, and why is it the case?
Do people use it in an unsafe manner because they don't understand git and there lies a problem that could be tackled? yes.
With that, I don't think git has any feature that is unsafe by default.
Well, you just mentioned `--force`. It is unsafe by default. Git has a couple of flags to make it safer (`--force-with-lease`, `--force-if-includes`) but those aren't the default.
Obviously they've done it for backwards compatibility, but the fact that they haven't even added an option to make it the default is pretty lame.
I’d I never cared about historical state and mistakes, I wouldn’t need version control at all :)
If stackoverflow told them to break off the chainsaw safety tab there is no chance it would have been read first.
The commits that were overwritten by "force" are still there on the server. Any admin could recover them pretty easily. They're probably still present in the local repo of the person who ran "git push --force" too, as well as anyone else's machine who has cloned the repo.
The only way you'd actually lose data is if every single person who had a clone of the repo ran gc.
Or apparently if nobody knew about "git reflog" and nobody bothered to do a Google search for "oops I accidentally force pushed in git" to learn how to fix it.