Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
James369
V2EX  ›  Linux

git 如何根据文件大小进行忽略,想跳过大文件。

  •  1
     
  •   James369 · Jun 24, 2021 · 4442 views
    This topic created in 1962 days ago, the information mentioned may be changed or developed.
    git 提交的时候能不能自动忽略大文件(比如超过 100M ),然后给个提示消息就好了。
    AoEiuV020
    AoEiuV020
    Jun 24, 2021❤️1
    1
    100M 是为了上传 github?
    感觉可以用 find 把所有大文件写进 gitignore,要自动就写个 hook,
    no1xsyzy
    no1xsyzy
    Jun 24, 2021
    2
    pre-commit 钩子里插 find 语句并 >> .gitignore
    James369
    James369
    OP
    Jun 24, 2021
    3
    @AoEiuV020 不是,我只是想本地做下文件备份
    no1xsyzy
    no1xsyzy
    Jun 24, 2021❤️1
    4
    顺便,如果要 lfs 的话也可以 | xargs git lfs track
    no1xsyzy
    no1xsyzy
    Jun 24, 2021
    5
    (忘记了钩子运行时机晚于 add,pre-commit 里写的话大概需要 unstage 一下)
    Chemist
    Chemist
    Jun 24, 2021 via iPhone
    6
    git 版冰点还原吗😂
    misaka19000
    misaka19000
    Jun 24, 2021
    7
    把大文件添加到 ignore 里面去

    或者写个脚本在提交前自动检测文件大小修改 ignore 文件
    jomenxiao
    jomenxiao
    Jun 24, 2021
    8
    alias git="find . -type f -max < 100 && git"
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   827 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 18:25 · PVG 02:25 · LAX 10:25 · JFK 13:25
    ♥ Do have faith in what you're doing.