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

Re: [PATCH 2/2] read-tree: at least one tree-ish argument is required

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2009, 19:49 UTC
Message-ID
<7veimsvz8a.fsf@alter.siamese.dyndns.org>
In-Reply-To
<fabb9a1e0912181137t1265f86cs9e02019da136a0a@mail.gmail.com>
Sverre Rabbelier <srabbelier@gmail.com> writes:
Show 9 quoted lines
> On Fri, Dec 18, 2009 at 13:32, Junio C Hamano <gitster@pobox.com> wrote:
>> Sure, it will empty the index, so it is dangerous in the same sense that
>> "reset --hard" is dangerous because it will wipe all your local changes,
>> or "rm -rf it" will remove everything underneath it.
>
> With the difference that both 'reset --hard' and 'rm -rf' need a flag
> to do their destructive work? Although 'git reset' might be just as
> destructive if you've been using 'git add -p' a lot or something,
> mhh...

I'll grant you that at least "rm -rf it" names "it" that will be wiped very explicitly. But just like the index and the work tree plus the index are the implicit targets to "reset" and "reset --hard" respectively, the index is the implicit target to "read-tree".

So it may be "dangerous" in the sense that "it would change things and if you meant to do something else the end result would be different from what you wanted to do". In that sense, "log", "cat-file" and friends may be danger-free commands and all others would be dangerous. You might type "commit" when you meant to say "commit -a" and record an incomplete state; it is "dangerous" in that sense.

These are part of their feature.
Previous: Sverre RabbelierNext: Sverre Rabbelier
Message 9 of 21 in “filter-branch: remove an unnecessary use of 'git read-tree'”
  1. 1/2 filter-branch: remove an unnecessary use of 'git read-tree'Johannes Sixt, Dec 15, 2009
  2. 2/2 read-tree: at least one tree-ish argument is requiredJohannes Sixt, Dec 15, 2009
  3. Johannes SixtDec 18, 2009
  4. Junio C HamanoDec 18, 2009
  5. Johannes SixtDec 18, 2009
  6. Sverre RabbelierDec 18, 2009
  7. Junio C HamanoDec 18, 2009
  8. Sverre RabbelierDec 18, 2009
  9. Junio C HamanoDec 18, 2009
  10. Sverre RabbelierDec 18, 2009
  11. Junio C HamanoDec 18, 2009
  12. Sverre RabbelierDec 18, 2009
  13. Johannes SixtDec 18, 2009
  14. Jakub NarebskiDec 18, 2009
  15. Junio C HamanoDec 18, 2009
  16. Nanako ShiraishiDec 19, 2009
  17. Junio C HamanoDec 19, 2009
  18. Junio C HamanoDec 19, 2009
  19. Johannes SchindelinDec 19, 2009
  20. Johannes SchindelinDec 15, 2009
  21. Junio C HamanoDec 16, 2009

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.