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

Re: On the behavior of checkout <branch> with uncommitted local changes

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 20, 2013, 22:58 UTC
Message-ID
<xmqq1u4jp0bw.fsf@gitster.dls.corp.google.com>
In-Reply-To
<2132571.7BXlKkKRkA@ipht-ia-004976>
r.ductor@gmail.com writes:
> mmm maybe I'm wrong, but it seems to me that the first statement
> on the index (above) is oversimplifing.

Yes, it was simplified to illustrate the principle, not even trying to be exhaustive.

The principle is that we allow you to check out a different branch when you have local changes to the working tree and/or to the index, as long as we can make the index and the working tree pretend as if you reached that locally modified state, starting from a clean state of the branch you are checking out.

That is what "your modifications in context" in the description of the "-m" option refers to.

It directly follows that a local change to the index at a path is carried forward when you check out a different branch, if HEAD and the branch you are checking out have the same contents registered at the path.

The message you are responding to illustrated that principle by talking about changes to the working tree but the same principle applies to changes to the index, as changes to the working tree is much easier to picture in your mind.

Previous: r.ductor@gmail.comNext: r.ductor@gmail.com
Message 4 of 5 in “On the behavior of checkout <branch> with uncommitted local changes”
  1. r.ductor@gmail.comSep 19, 2013
  2. Junio C HamanoSep 19, 2013
  3. r.ductor@gmail.comSep 20, 2013
  4. Junio C HamanoSep 20, 2013
  5. r.ductor@gmail.comSep 24, 2013

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.