Javier Villanueva
Javier Villanueva

Reputation: 4058

How to checkout the contents of a directory in git?

I have a repo with a 'htdocs` directory in its root, is it possible to checkout only the contents of this folder? I tried running:

git checkout -f master -- htdocs

Which does ignore everything else in the repo root but it also brings in the htdocs folder. I could copy the contents and remove the directory with a couple additional commands but I was wondering if it was possible with through git only.

Upvotes: 0

Views: 228

Answers (1)

Akram Fares
Akram Fares

Reputation: 1683

You can checkout in an external folder, and make a symbolic link between /htdocs and that folder.

Upvotes: 1

Related Questions