How to sparsely checkout only one single file from a git repository?

前端 未结 21 1611
Happy的楠姐
Happy的楠姐 2020-11-22 08:14

How do I checkout just one file from a git repo?

21条回答
  •  逝去的感伤
    2020-11-22 08:46

    It sounds like you're trying to carry over an idea from centralized version control, which git by nature is not - it's distributed. If you want to work with a git repository, you clone it. You then have all of the contents of the work tree, and all of the history (well, at least everything leading up to the tip of the current branch), not just a single file or a snapshot from a single commit.

     git clone /path/to/repo
     git clone git://url/of/repo
     git clone http://url/of/repo
    

提交回复
热议问题