Is it possible for git lfs pull to ignore some files / folders?

前端 未结 3 1672
太阳男子
太阳男子 2020-12-16 12:45

Short question: Is it possible to configure git such that regular git pull will ignore some files?

Problem description: I have a repository that includes some large

3条回答
  •  天命终不由人
    2020-12-16 13:24

    I ran into this man page, I didn't tested but hopefully it helps:


    INCLUDE AND EXCLUDE

    You can configure Git LFS to only fetch objects to satisfy references in certain paths of the repo, and/or to exclude certain paths of the repo, to reduce the time you spend downloading things you do not use.

    In gitconfig, set lfs.fetchinclude and lfs.fetchexclude to comma-separated lists of paths to include/exclude in the fetch (wildcard matching as per gitignore). Only paths which are matched by fetchinclude and not matched by fetchexclude will have objects fetched for them.

    Examples:

    • git config lfs.fetchinclude "textures,images/foo*"

      This will only fetch objects referenced in paths in the textures folder, and files called foo* in the images folder

    • git config lfs.fetchinclude "*.jpg,*.png,*.tga"

      Only fetch JPG/PNG/TGA files, wherever they are in the repository

    • git config lfs.fetchexclude "media/reallybigfiles"

      Don't fetch any LFS objects referenced in the folder media/reallybigfiles, but fetch everything else

    • git config lfs.fetchinclude "media"
      git config lfs.fetchexclude "media/excessive"

      Only fetch LFS objects in the 'media' folder, but exclude those in one of its subfolders.

提交回复
热议问题