I have checked-out a branch (BranchA), made changes to the code.
Then I connect to different branch (BranchB) without committing code from IDE.
The changes I had made on BranchA in IDE are lost?
Usually, you cannot check-out another branch if you have unsaved changes. You either commit those (i.e. everything is saved) or explicitly discard the changes (i.e. everything is lost) and only then check-out the other branch so that there is no ambiguity.