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

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

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

21条回答
  •  不思量自难忘°
    2020-11-22 08:57

    Say the file name is 123.txt, this works for me:

    git checkout --theirs  123.txt
    

    If the file is inside a directory A, make sure to specify it correctly:

    git checkout --theirs  "A/123.txt"
    

提交回复
热议问题