I made some changes in my master branch and without committing them, I checked out to development branch. I was expecting an error to be thrown but instead of that, my changes in master branch are merged with development branch.
$ git checkout development
Switched to branch 'development'
M pom.xml
Your branch is up-to-date with 'origin/development'.
Instead of this I was expecting the below error, so that I could stash or commit my changes before checking out:
error: You have local changes ....; cannot switch branches.
Does anybody know why it happened or how can I prevent it to happen again?