Skip to content

Instantly share code, notes, and snippets.

@sumardi
Created May 11, 2013 12:56

Revisions

  1. sumardi created this gist May 11, 2013.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    # New repository
    mkdir <repo> && cd <repo>
    git init
    git remote add –f <name> <url>
    git config core.sparsecheckout true
    echo some/dir/ >> .git/info/sparse-checkout
    echo another/sub/tree >> .git/info/sparse-checkout
    git pull <remote> <branch>

    # Existing repository
    git config core.sparsecheckout true
    echo some/dir/ >> .git/info/sparse-checkout
    echo another/sub/tree >> .git/info/sparse-checkout
    git read-tree -mu HEAD

    # If you later decide to change which directories you would like checked out,
    # simply edit the sparse-checkout file and run git read-tree again as above.
    # http://schacon.github.io/git/git-read-tree.html#_sparse_checkout