I've cloned my repository via git clone, and now I want to checkout a folder.
Source folder: /opt/XYZ/foldertochecout
and it should be checked out to
/var/www/foldertochecout
Is that possible and how?
git checkout allows specifying a path after the -- argument separator. So for example, this will check out only that directory:
git checkout HEAD -- opt/XYZ/foldertocheckout
(assuming that opt/XYZ/ is also part of your repository—although that seems a bit unlikely and XYZ is probably your repository directory)