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

Re: Git branches - confusing behavior

From
DKDima Kagan <dima.kagan@gmail.com>
Date
May 11, 2008, 12:21 UTC
Message-ID
<4826E4BA.9080506@gmail.com>
In-Reply-To
<f35478f50805110513h15aa462bs9ee35ed4738d3009@mail.gmail.com>
Show 24 quoted lines
> On Sun, May 11, 2008 at 1:58 PM, Dima Kagan <dima.kagan@gmail.com> wrote:
> 
>>  >> Basically I see that the same file I edited on the 'test_branch'
>>  >> branch appears to be modified on the 'master' branch as well. This
>>  >> behavior is unwanted, of course.
>>  >>
>>  >> Can someone please tell me, what am doing wrong? Or is this git's
>>  >> normal behavior?
>>  >
>>  > This is normal, and wanted, behavior.
>>  >
>>
>>  That's a subjective point of view :) I'm coming from the SVN world and uncommitted changes on one branch don't affect other branches. Is there a way I can achieve this behavior with git?
> 
> There are several ways, actually.
> 
> The one I prefer to use is to commit the modifications. Then, you can
> use git-reset HEAD^ to drop that temporary commit when you come back
> to this branch, or git-commit --amend to modify it.
> 
> Always keep in mind that in git's world, history is not set in stone,
> you can always modify previous commits, reorder them or merge them, as
> long as you have not pushed them to your public repository (in your
> case, the SVN one).

Hi! Thanks for these little tips.

I understand that git is very powerful, however some things are hard to grasp when switching from SVN. Perhaps I should overview my workflow to see how it can benefit from git, despite these differences.
Previous: Theodore TsoNext: Patrick Aljord
Message 18 of 19 in “Git branches - confusing behavior”
  1. Dima KaganMay 11, 2008
  2. Jakub NarebskiMay 11, 2008
  3. Dima KaganMay 11, 2008
  4. David SymondsMay 11, 2008
  5. Dima KaganMay 11, 2008
  6. David SymondsMay 11, 2008
  7. Dima KaganMay 11, 2008
  8. Steve FrécinauxMay 11, 2008
  9. Jakub NarebskiMay 11, 2008
  10. Dima KaganMay 11, 2008
  11. Björn SteinbrinkMay 11, 2008
  12. Dima KaganMay 11, 2008
  13. Björn SteinbrinkMay 11, 2008
  14. Dima KaganMay 11, 2008
  15. Teemu LikonenMay 11, 2008
  16. Miles BaderMay 12, 2008
  17. Theodore TsoMay 11, 2008
  18. Dima KaganMay 11, 2008
  19. Patrick AljordMay 11, 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.