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
Using basic git commands only:
This answer is a bit longer than that of Charles, but it consists solely of basic git commands that I can understand and thus remember, eliminating the need to keep looking it up.
Mark your current location (commit first if needed):
git checkout -b temp
Reset (moves) the marker to the other branch without changing working dir:
git reset
now temp and other branch point to the same commit, and your working dir is untouched.
git checkout
since your HEAD is already pointing to the same commit, working dir is not touched
git branch -d temp
Note that these commands are also readily available from any graphical client.