0

Hello I encountered this odd behavior a few years back and it’s annoying af. It seems like it changed overnight at some point to me anyway.

Expected behavior: When I checkout a new branch ‘y’ from branch ‘x’ and do some work on ‘y’ I expect branch ‘x’ to be exactly the same as before I checkedout ‘y’ whenever I go checkout back into branch ‘x’.

Whats bugging me: When I return to branch ‘x’ the work I did in branch ‘y’ is reflected on ‘x’ unfortunately wtf?!?!

Git version 2.31.1 - windows 10

Men of culture we'll meet again!

Edit: what needs to be done for subbranches to inherit from parent and for parent branches to stay independent from childs. If I want to mimic subbranch I'll pull. Hello there is a thought.

  • 3
    Did you commit or stash your changed before switching back to x? Otherwise this is an expected behaviour. – Eselfar Jun 29 '21 at 00:41
  • The given links, as already answered, point to a confusing, albeit, default process that seems so overly complicated! Look when I spawn a child branch YOU stash for me, YOU apply the stash to the new branch and then give me my new branch: an exact match of parent up to the second I spawned. If and when I go back to parent you stash changes in child, YOU then apply original stashed changes on parent and finally YOU present me with the parent branch exactly as it was before I spawned child. Basically is there some sort of global git config were I could set this as default? – Overflower Illustrious Jul 04 '21 at 17:08
  • The question is more: why are you constantly switching branches? If you want to compare with another version while you're working on something, a solution (among others) is to clone the repo twice and to open 2 Android Studio. One AS will be on the branch you're working on, the other one will be the branch you want to compare to. – Eselfar Jul 05 '21 at 01:56

0 Answers0