Git: How do I clone a subdirectory only of a Git repository?

前端 未结 18 2967
时光说笑
时光说笑 2020-11-21 04:33

I have my Git repository which, at the root, has two sub directories:

/finisht
/static

When this was in SVN, /finisht was chec

18条回答
  •  梦毁少年i
    2020-11-21 04:53

    While I hate actually having to use svn when dealing with git repos :/ I use this all the time;

    function git-scp() (
      URL="$1" && shift 1
      svn export ${URL/blob\/master/trunk}
    )
    

    This allows you to copy out from the github url without modification. Usage;

    --- /tmp » git-scp https://github.com/dgraph-io/dgraph/blob/master/contrib/config/kubernetes/helm                                                                                                                  1 ↵
    A    helm
    A    helm/Chart.yaml
    A    helm/README.md
    A    helm/values.yaml
    Exported revision 6367.
    
    --- /tmp » ls | grep helm
    Permissions Size User    Date Modified    Name
    drwxr-xr-x     - anthony 2020-01-07 15:53 helm/
    

提交回复
热议问题