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

You have local changes; cannot switch branches error question

From
ESEugene Sajine <euguess@gmail.com>
Date
Dec 24, 2009, 22:25 UTC
Message-ID
<76c5b8580912241425k741b24e9ie8ed92ca7cb8a659@mail.gmail.com>

First of all Merry Christmas and Happy New Year to everybody! I wish Git to move to global dominance during next year even faster then it does now;)

My question is related to the fact that most of the time when i have some local file changes Git is switching branches OK. But from time to time in some repos I'm hitting this error and I cannot figure out why it suddenly starts to complain about it?

For example in one of my repos I somehow got to a state when I have three files modified, and when I'm trying to switch branches it complains about one of them being changed locally, so it refuses to switch branch

OTOH i have tried many different scenarios in another repo to leave some uncommitted staged or not staged changes and switch branches and same version of git does that just fine. (v 1.6.5.6).

So, what is correct behavior - do not switch or switch branches when there are uncommitted changes?

Thanks, Eugene

Next: Nanako Shiraishi
Message 1 of 4 in “You have local changes; cannot switch branches error question”
  1. Eugene SajineDec 24, 2009
  2. Nanako ShiraishiDec 24, 2009
  3. Junio C HamanoDec 24, 2009
  4. Matthieu MoyDec 25, 2009

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.