git clean all submodules on branch switch

Shell
# Be careful it will delete all untracked files, reset all stagated files
# and will remove all submodule folders
git reset --hard
git checkout gh-pages
git clean -xffd
# Optional restoration of submodules content
git submodule update --init --recursive
Source

Also in Shell: