I think you do not run "git submodule update" after switching branches. This is required to sync your submodule to the revision that is set in the branch.

A good tip is also to use "git add -p" to select which edits you want to commit