0
  1. I checked out master and then created a branch out of it (with checkout): patchA
  2. I made some changes, committed, pushed, even made a pull request for branch patchA
  3. Pull Request has not yet been reviewed (and not yet merged into master, of course)
  4. I then created another branch out of master (with checkout): patchB
  5. I made some changes, didn't even commit those...

*** Now, I wanted to take a look into patchA, so I checked it out - I see my changes that I pushed but also the changes I made in patchB !

Why is that? I thought the whole idea of branches is to isolate work, to make things a little neater for delivering units of work and reviewing them...

More info: When checking out patchB, I don't see the changes from patchA

DraxDomax
  • 1,008
  • 1
  • 9
  • 28
  • 2
    Uncommited changes aren't reverted when switching branches. If they were, you'd lose them very easily. In other words: these changes don't "belong" to `patchB` in any meaningful way: only once they are commited will the be associated with that branch. – Joachim Sauer Jan 12 '21 at 23:25
  • that makes sense. I committed and the patchA stuff disappeared from patchB. Thank you! BTW: I can see why this is useful but it's a little weird to see changes unrelated to the branch show up :) – DraxDomax Jan 12 '21 at 23:31
  • 1
    "*I made some changes, **didn't even commit** those*" That's the culprit. https://stackoverflow.com/a/246298/7976758: "*The key to remember is that the file was **not** modified in the … branch. It was only modified in your working copy.*" — *Gareth* – phd Jan 12 '21 at 23:49

0 Answers0