Filetree is not refreshing after switching branches

rails
git

#1

I am doing simple rails app in master branch. I decide to experiment a little, so I create new branch like this:
git checkout -b experiment-branch
Then I am creating some controllers, models etc. but experiment fails. However I dont’t want to delete this branch. I try to go back to master:
git checkout master
and code (controllers, models etc) from the previous experiment is still there in filetree, ApplicationController etc.

I assume the second command should return me the state of my app from before the experiment. Am I right or I do something wrong?