Tuesday, February 28, 2012

Checkout subdirectory in git for previous revision

From: http://stackoverflow.com/questions/5859943/subdirectories-in-checked-out-directory-of-a-previous-revision-not-disappearing

To checkout a sub-folder from a previous revision, what you do is three commands:

git reset <hash> thing/
git checkout <hash> thing/
git clean -fd thing/

To revert back to the HEAD state:

git reset HEAD thing/
git checkout HEAD thing/
git clean -fd thing/

I didn't try the three HEAD commands above. But should work.

No comments: