git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: why is git destructive by default? (i suggest it not be!)

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Jun 25, 2008, 18:06 UTC
Message-ID
<20080625180608.GC5737@dpotapov.dyndns.org>
On Tue, Jun 24, 2008 at 10:13:13PM -0000, David Jeske wrote:
> 
> Two things I'd like to make it easy for users to never do are:
> - delete data
> - cause refs to be dangling

Why? Let's suppose you work with CVS and you started to edit some file and then realize than the change that you make is stupid, would not you want just to discard these change without committing them to CVS?

Perhaps, you are confused by thinking that git commit and cvs commit are conceptually same commands. IMHO, far better to analogue to cvs commit would be git push to a repository with denyNonFastForwards policy. Git commit allows you to save your changes locally as series of patches, but until you have not pushed them, they are not in a permanent storage. You can change these patches, which implies that old versions may become dangling and will be removed after reflog expired. The idea of making of making difficult to remove some local commits is alike the idea of an editor making difficult to remove a line... You gain nothing from that. What editors do instead is to provide the Undo action. Similarly, Git allows you to get back to an old state using the reflog.

Dmitry
Message 1 of 1 in “Re: why is git destructive by default? (i suggest it not be!)”
  1. Dmitry PotapovJun 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.