Comment

Comment by xyzzyz

It's not completely true, you can easily lose data in Git by accident. Here's an example. Suppose we have a single "master" branch, pointing to commit A. You create a new "feature" branch, making commits B, and then C. You realize that B and C are actually unrelated, so you want each of them to have separate branches. You git rebase --interactive onto master, picking only commit C. This way feature branch has commit C with parent A. Now, you git checkout commit B, which should put you into detached HEAD state, from which you plan to create a second feature branch. Alas, something has triggered git gc in the meantime, and commit B has been garbage collected, as it was no longer pointed to by anything.

Something like this happened to me, breaking the whole Chromium repo for half an hour. Definitely not fun.

parent xyzzyz 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton