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

From: Junio C Hamano <[email-masked]>
Date: Fri, 20 Sep 2013 15:58:27 -0700

[email-masked] 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.