Re: why is git destructive by default? (i suggest it not be!)
From: Jan Krüger <hidden>
Date: 2016-06-15 22:44:48
Hi David, "David Jeske" [off-list ref] wrote:
I moved a branch around and then deleted it, and I don't see any record in the reflog of where it was, or that it ever was.
If a branch you're trying to delete is not part (or, more correctly,
an ancestor) of your current branch, you'll get a warning that you have
to explicitly bypass by using -D rather than -d.
Still, after deleting the branch, its old tip will very likely show up
in the reflog for HEAD (at the point you last worked on the branch),
even if the branch name won't show up anywhere. After locating the
commit in there it's a simple case of git checkout -b whatever
HEAD@{123} to get back that branch.
What prevents someone from accidentally deleting an old branch that nobody is watching, but is important to the history and then not noticing as gc silently deletes the old deltas?
One thing to keep in mind is that deleting your branch locally won't rid you of remote copies of it, so anything that you considered worth sharing will probably survive even if you accidentally bypassed Git's warning about deleting branches. Best, Jan