linux - I cannot clone git tree -
i have question git, tried clone tree without success.
git clone https://github.com/cer/event-sourcing-examples/tree/d2077e21aa677a00095f90250470ff011c132ab8/java-spring
i cloned project
git clone https://github.com/cer/event-sourcing-examples
and tried switch tree no effect
would have suggestions ?
best regards
git cannot clone tree directly. need clone entire repository, , check out commit uses tree want. sake of reducing confusions, though, note there difference between terms "tree" , "commit", though:
- a tree git object representing directory, , contains links blobs (files) , other trees. tree not root directory of repository.
- a commit object contains link root tree of repository, , information such commit message, dates , other headers.
you can check out commits. few git commands deal directly tree objects (git cat-file
, git ls-tree
being among exceptions). however, object id in github url indeed id of commit, that's not problem.
what can do, then, check out commit want new branch after you've cloned repository:
git checkout -b test-branch d2077e21
if problem you're trying solve fetching single commit (or tree) remote repository, you're out of luck, because git's remote protocol not support operation. if anything, if can insert branch remote repository @ commit want, can clone branch directly, without history:
git clone -b test-branch --depth 1 https://github.com/cer/event-sourcing-examples
if can't that, however, you're still out of luck. remote protocol allows referencing named refs, not arbitrary commits.
Comments
Post a Comment