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

Re: Git reset --hard with staged changes

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 9, 2014, 23:28 UTC
Message-ID
<xmqq61k9d5nk.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CANWD=rVB249Vu1QMk64V+FxfCfJPzxqZgCfyEuixJJ_iKoTLPQ@mail.gmail.com>
Pierre-François CLEMENT <likeyn@gmail.com> writes:
> Hm, I didn't think of "git apply --index"... Makes sense for this
> special use, but I'm not sure about the other use cases.

Try merging another branch that tracks a file your current branch does not know about and ending up with conflicts during that merge. Resetting the half-done result away must remove that new path from your working tree and the index.

Previous: Pierre-François CLEMENTNext: Pierre-François CLEMENT
Message 4 of 9 in “Re: Git reset --hard with staged changes”
  1. Pierre-François CLEMENTJun 9, 2014
  2. David KastrupJun 9, 2014
  3. Pierre-François CLEMENTJun 9, 2014
  4. Junio C HamanoJun 9, 2014
  5. Pierre-François CLEMENTJun 10, 2014
  6. David KastrupJun 10, 2014
  7. Pierre-François CLEMENTJun 10, 2014
  8. Dale WorleyJun 10, 2014
  9. Junio C HamanoJun 10, 2014

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.