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

Re: [Bug?] uncommited changes cross branches

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 5, 2008, 15:07 UTC
Message-ID
<alpine.LSU.1.00.0802051502360.8543@racer.site>
In-Reply-To
<CB070331-8CA6-42CD-9CAD-20371F16DCD8@gmail.com>
Hi,
On Tue, 5 Feb 2008, Rhodes, Kate wrote:
Show 5 quoted lines
> If you have a file that exists in two branches in the same repo, make a 
> change to it without committing, then switch branches the changes carry 
> over, but if you make changes to a file that exists in only one of the 
> repos and try and switch branches Git complains that the file isn't 
> uptodate.  The latter behavior seems correct to me.

It is slightly different: if you change a file without committing _-and- the switch to another branch does not touch the file, git does not complain.

The rationale: git should refuse to switch branches _only_ if uncommitted changes would be lost.

However, if you change a file whose content is different in the other branch (and "not existing" qualifies), the uncommitted changes would be lost, and git should complain.

Ciao, Dscho

Previous: Rhodes, KateNext: Rhodes, Kate
Message 2 of 3 in “[Bug?] uncommited changes cross branches”
  1. Rhodes, KateFeb 5, 2008
  2. Johannes SchindelinFeb 5, 2008
  3. Rhodes, KateFeb 5, 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.