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

Re: newbie question

From
dloewenherz@gmail.com <dloewenherz@gmail.com>
Date
Jul 3, 2009, 19:12 UTC
Message-ID
<20090703191230.GA2446@andros>
In-Reply-To
<e4a904790907031139rc61c2e0t6b9dbbc0c3dc379e@mail.gmail.com>

Until you commit the files, the changes will follow you to whatever branch you go to. If you don't want to commit, but still want to switch to B and not see the changes in A, I would recommend using `git stash`.

e.g.

git checkout A ...edit... git stash save changes git checkout B git status

You'll see that your tree is clean. To get your changes back to A, just run

git checkout A git stash pop changes

Best, Dan

On 03/07/09 11:39 -0700, Alex K wrote:
Show 16 quoted lines
>Hello,
>
>I would think the following simple pattern would be possible:
>
>Create two branches A and B. Switch to A, modify some files, do not
>commit to A, switch to B. Now B should not show any of the changes
>performed to A? However a git status while on B does show that the
>files on A have been modified. Is there something I am missing?
>
>Thank you,
>
>Alex
>--
>To unsubscribe from this list: send the line "unsubscribe git" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Alex KNext: Junio C Hamano
Message 2 of 5 in “newbie question”
  1. Alex KJul 3, 2009
  2. dloewenherz@gmail.comJul 3, 2009
  3. Junio C HamanoJul 3, 2009
  4. Sitaram ChamartyJul 4, 2009
  5. Michael J GruberJul 6, 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.