-1

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,774
  • 10
  • 66
  • 83
Felix
  • 5,452
  • 12
  • 68
  • 163

1 Answers1

6

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
  • 369,085
  • 72
  • 557
  • 602
  • 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