git lfs pull可能会忽略一些文件/文件夹吗? [英] Is it possible for git lfs pull to ignore some files / folders?

查看:1793
本文介绍了git lfs pull可能会忽略一些文件/文件夹吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

简短的问题:
是否可以配置git,以便常规的git pull会忽略某些文件?

问题描述:
我有一个包含一些大型数据文件的仓库(使用git lfs存储)

虽然一些处理数据文件的开发人员需要这些文件的更新版本,但其他开发人员需要这些文件,但不一定是最新版本。



他们需要更新的代码版本。数据文件与代码位于同一个存储库中。



我想设置普通的pull不会更新数据文件。

>


  • 我知道可以在不从LFS下载文件的情况下执行pull操作,但是这会用指针文件替换文件,而且我需要先前版本的文件。


解决方案

我碰到这个手册页,我没有测试,但希望它有帮助:






INCLUDE AND EXCLUDE



你可以配置Git LFS来只读取对象以满足某些
回购路径中的参考,和/或排除回购的某些路径,以减少您下载不使用的
时间。



在gitconfig中,将lfs.fetchinclude和lfs.fetchexclude设置为逗号分隔列表
的路径,以便在提取中包含/排除(根据gitignore进行通配符匹配)。
只有通过fetchinclude匹配并且不与fetchexclude
匹配的路径才会为它们获取对象。



示例:




  • git config lfs.fetchincludetextures,images / foo *



    这只会获取纹理文件夹中路径中引用的对象,而
    文件在images文件夹中称为foo *


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



    只能抓取JPG / PNG / TGA文件,无论它们在存储库中何处

  • / code>



    不要获取文件夹media / reallybigfiles中引用的任何LFS对象,但
    可以获取其他所有内容


  • git config lfs.fetchincludemedia

    git config lfs。 fetchexcludemedia / excess



    只在'media'文件夹中获取LFS对象,但排除其中一个ts
    子文件夹。


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 data files (stored using git lfs)

While some developers who work on the data files need updated versions of these files, other developers need the files, but not necessarily the most recent version.

They do need updated code versions. And the data files are in the same repository as the code.

I want to set up for way that a regular pull wouldn't update the data files.

  • I know it's possible to do a pull without downloading files from LFS, but this will replace the files with pointer files, and I need the previous version of the files.

解决方案

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.

这篇关于git lfs pull可能会忽略一些文件/文件夹吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆