Is it possible in Git to switch to another branch without checking out all files?
After switching branch I need to delete all files, regenerate them, commit and swit
Yes, you can do this.
git symbolic-ref HEAD refs/heads/otherbranch
If you need to commit on this branch, you'll want to reset the index too otherwise you'll end up committing something based on the last checked out branch.
git reset