• 请不要在回答技术问题时复制粘贴 AI 生成的内容
gouchaoer2
V2EX  ›  程序员

git 为啥不把目录当成文件, Linux 哲学不是 everything is a file 么?

  •  
  •   gouchaoer2 · Feb 2, 2019 · 4876 views
    This topic created in 2833 days ago, the information mentioned may be changed or developed.

    git 有时候会有一些问题,比如刚 check out 一个带有 lfs 的很大的 repo 的时候,出来一堆 untracked files (之前也遇到很多次)。。。然后打算先 git clean -f,然后 git reset --hard,结果发现 untracked files 还有许多目录没有办法清理,我顿时就不明白了。。。你说你不负责管理一个空目录,里面必须加一个.gitkeep 或者空的.gitignore 我也就忍了,可是有时候你又不认,你 everything is a file 的设计哲学呢?你的 consistent 呢?

    22 replies  •  2020-05-02 16:37:23 +08:00
    lululau
    lululau
    Feb 2, 2019
    1
    除了是一个爸爸之外,这俩还有啥关心?
    lululau
    lululau
    Feb 2, 2019
    2
    关系
    secondwtq
    secondwtq
    Feb 2, 2019 via iPhone❤️1
    3
    那是 unix 哲学,不是 linux 哲学
    tempdban
    tempdban
    Feb 2, 2019
    4
    git clean -df
    gouchaoer2
    gouchaoer2
    OP
    Feb 2, 2019
    5
    @tempdban 这个管用,3q
    tempdban
    tempdban
    Feb 2, 2019
    6
    @gouchaoer2 不是你连 help 都不看的么,上来就怼?
    gouchaoer2
    gouchaoer2
    OP
    Feb 2, 2019
    7
    @tempdban 我错了还不行么?
    gouchaoer2
    gouchaoer2
    OP
    Feb 2, 2019
    8
    一个 lfs 特性都做不好,每次 check out 都出问题我也很无奈啊
    frylkrttj
    frylkrttj
    Feb 2, 2019
    9
    比我还菜系列
    gouchaoer2
    gouchaoer2
    OP
    Feb 2, 2019
    10
    @frylkrttj 是的,在用 git 上比你菜,但不是所有的事情都比你菜哦
    frylkrttj
    frylkrttj
    Feb 2, 2019
    11
    @frylkrttj 不服看看我刚发的帖子。百度都被我翻烂了都没找到我要得。
    newmind
    newmind
    Feb 2, 2019
    12
    这一点有的时候会坑人
    本机目录是存在的
    同步到其他机器上运行提示目录不存在
    那么多空目录需要添加.gitkeep
    麻烦
    sdijeenx
    sdijeenx
    Feb 2, 2019❤️4
    13
    "Everything is a file" describes one of the defining features of Unix, and its derivatives — that a wide range of input/output resources such as documents, directories, hard-drives, modems, keyboards, printers and even some inter-process and network communications are simple streams of bytes exposed through the filesystem name space.
    https://en.wikipedia.org/wiki/Everything_is_a_file

    "Everything is a file"是 UNIX like 系统把一切硬件都当成文件,总结一下就是"Everything is a file"。

    UNIX 哲学:
    1.小即是美;
    2.每一个程序只做好一件事;
    3.尽快建立设计原型;
    4.舍去效率换取可移植性;
    5.使用纯文本来存储数据;
    6.充分利用软件的杠杆效应;
    7.使用 Shell 脚本提高杠杆效应和可移植性;
    8.避免强制用户界面;
    9.让每一个程序都成为过滤器。

    UNIX 哲学不代表 UNIX 系统:
    未来某一天 Linux 可能会见证到自身被一个较新的系统所取代,以一种我们想象不到的方式。这其实没什么大不了的,当这种情况发生时,那些早就知道该如何“像 UNIX 那样思考”的人们会为此做好准备。

    让我们继续,做一件事情并把它做好,最后你的辛苦必将获得回报。
    junjieyuanxiling
    junjieyuanxiling
    Feb 2, 2019 via Android
    15
    Linus 的哲学是实用……
    junjieyuanxiling
    junjieyuanxiling
    Feb 2, 2019 via Android
    16
    @gouchaoer2 lfs 是 git 的扩展,git 本质上是个源代码管理软件。要管理二进制大文件可以用 OSTree。
    reus
    reus
    Feb 2, 2019
    17
    无能狂怒
    reus
    reus
    Feb 2, 2019❤️2
    18
    何况 lfs 又不是 git 官方的,是 github 开发的扩展,这都能怼到 linux 头上,不知所谓。
    loading
    loading
    Feb 2, 2019 via Android❤️2
    19
    建议提 pr,看他爸爸能不能把你喷飞。
    gouchaoer2
    gouchaoer2
    OP
    Feb 2, 2019
    20
    @reus 我怎么这么菜呢?气死我了!
    kisara
    kisara
    Feb 11, 2019
    21
    git 就是 git 跟 linux 有啥关系?
    shily
    shily
    May 2, 2020 via Android
    22
    @kisara 一个爸爸啊,不一致的话就是爸爸精神分裂啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1390 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 18:43 · PVG 02:43 · LAX 10:43 · JFK 13:43
    ♥ Do have faith in what you're doing.