-2

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?

random
  • 9,571
  • 10
  • 67
  • 79
Felix
  • 5,161
  • 9
  • 58
  • 146

1 Answers1

3

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)

poke
  • 339,995
  • 66
  • 523
  • 574
  • this is the reopository: /opt/XYZ and the foldertochecout is a subfolder in the repository. and I want to check it out in the apach folder under /var/www/destination – Felix Mar 09 '15 at 12:56