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

Re: [PATCH] reset --hard/read-tree --reset -u: remove unmerged new paths

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 16, 2008, 14:49 UTC
Message-ID
<7v8wsok32m.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20081016072010.GA19188@elte.hu>
Ingo Molnar <mingo@elte.hu> writes:
> Does your fix mean that all i have to do in the future is a hard reset 
> back to HEAD, and that dangling files are not supposed to stay around?

As long as the index *somehow* knows about these new files, they are removed.

The situation is:
 (0) you start from a HEAD that does not have path xyzzy;
 (1) you attempt to merge a rev that has path xyzzy;
 (2) the merge conflicts, leaving higher staged index entries for the
     path.
 (3) you decide not to conclude the merge by saying "reset --hard".

The old logic for "reset" was to remove paths that exist in the index at stage #0 (i.e. cleanly merged) and not in HEAD. The patch changes the rule to remove paths that exist in the index at any stage (i.e. including the ones that have conflicted and not resolved yet) and not in HEAD.

Previous: Ingo Molnar
Message 24 of 24 in “Untracked working tree files”
  1. Andrew MortonOct 15, 2008
  2. david@lang.hmOct 15, 2008
  3. david@lang.hmOct 15, 2008
  4. Andrew MortonOct 15, 2008
  5. Andrew MortonOct 15, 2008
  6. Nicolas PitreOct 15, 2008
  7. Nicolas PitreOct 15, 2008
  8. Linus TorvaldsOct 15, 2008
  9. david@lang.hmOct 15, 2008
  10. Linus TorvaldsOct 15, 2008
  11. david@lang.hmOct 15, 2008
  12. Andrew MortonOct 15, 2008
  13. Linus TorvaldsOct 15, 2008
  14. Andrew MortonOct 15, 2008
  15. Paolo CiarrocchiOct 16, 2008
  16. Andrew MortonOct 16, 2008
  17. Linus TorvaldsOct 15, 2008
  18. Andrew MortonOct 15, 2008
  19. Junio C HamanoOct 15, 2008
  20. reset --hard/read-tree --reset -u: remove unmerged new pathsJunio C Hamano, Oct 15, 2008
  21. Linus TorvaldsOct 15, 2008
  22. Junio C HamanoOct 16, 2008
  23. Ingo MolnarOct 16, 2008
  24. Junio C HamanoOct 16, 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.