tmsblgh tmsblgh - 1 year ago 106
Git Question

Is there any way to download only a directory from git repo?

Is it possible to download only a sub directory from a git repository?

Or download a specific commit's state?

I read about tags, but the repository which I would like to download does not have any tags...

Answer Source

Since it looks like you have two separate questions, I think I can address both.

1.) Download only a subdirectory from a git repository

git fetch
git checkout HEAD directory/subdirectory

2.) Download a specific commits state

You can do a hard reset using the commit id. (a hard reset will discard any local changes and bring your repo back to the state of that commit)

git reset --hard {commit_id}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download