Created
July 24, 2014 08:44
-
-
Save maestrow/c69627afc75d6f809bc2 to your computer and use it in GitHub Desktop.
Git checkout from a specific directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/17833185/git-checkout-from-a-specific-directory | |
# Method №1 | |
mkdir <repo.git> | |
mkdir <working-dir> | |
git clone <repo-url> <repo.git> --bare --depth 1 | |
git --git-dir=<repo.git> --work-tree=<working-dir> checkout HEAD -- <repo-subdir> | |
# Method №2 | |
mkdir <working-dir> | |
cd <working-dir> | |
mkgir .git | |
git clone <repo-url> .git --bare --depth 1 | |
git --work-tree=. checkout HEAD -- <repo-subdir> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment