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

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

  •  
  •   gouchaoer2 · Feb 2, 2019 · 4546 views
    This topic created in 2684 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
        1
    lululau  
       Feb 2, 2019
    除了是一个爸爸之外,这俩还有啥关心?
    lululau
        2
    lululau  
       Feb 2, 2019
    关系
    secondwtq
        3
    secondwtq  
       Feb 2, 2019 via iPhone   ❤️ 1
    那是 unix 哲学,不是 linux 哲学
    tempdban
        4
    tempdban  
       Feb 2, 2019
    git clean -df
    gouchaoer2
        5
    gouchaoer2  
    OP
       Feb 2, 2019
    @tempdban 这个管用,3q
    tempdban
        6
    tempdban  
       Feb 2, 2019
    @gouchaoer2 不是你连 help 都不看的么,上来就怼?
    gouchaoer2
        7
    gouchaoer2  
    OP
       Feb 2, 2019
    @tempdban 我错了还不行么?
    gouchaoer2
        8
    gouchaoer2  
    OP
       Feb 2, 2019
    一个 lfs 特性都做不好,每次 check out 都出问题我也很无奈啊
    frylkrttj
        9
    frylkrttj  
       Feb 2, 2019
    比我还菜系列
    gouchaoer2
        10
    gouchaoer2  
    OP
       Feb 2, 2019
    @frylkrttj 是的,在用 git 上比你菜,但不是所有的事情都比你菜哦
    frylkrttj
        11
    frylkrttj  
       Feb 2, 2019
    @frylkrttj 不服看看我刚发的帖子。百度都被我翻烂了都没找到我要得。
    newmind
        12
    newmind  
       Feb 2, 2019
    这一点有的时候会坑人
    本机目录是存在的
    同步到其他机器上运行提示目录不存在
    那么多空目录需要添加.gitkeep
    麻烦
    sdijeenx
        13
    sdijeenx  
       Feb 2, 2019   ❤️ 4
    "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
        15
    junjieyuanxiling  
       Feb 2, 2019 via Android
    Linus 的哲学是实用……
    junjieyuanxiling
        16
    junjieyuanxiling  
       Feb 2, 2019 via Android
    @gouchaoer2 lfs 是 git 的扩展,git 本质上是个源代码管理软件。要管理二进制大文件可以用 OSTree。
    reus
        17
    reus  
       Feb 2, 2019
    无能狂怒
    reus
        18
    reus  
       Feb 2, 2019   ❤️ 2
    何况 lfs 又不是 git 官方的,是 github 开发的扩展,这都能怼到 linux 头上,不知所谓。
    loading
        19
    loading  
       Feb 2, 2019 via Android   ❤️ 2
    建议提 pr,看他爸爸能不能把你喷飞。
    gouchaoer2
        20
    gouchaoer2  
    OP
       Feb 2, 2019
    @reus 我怎么这么菜呢?气死我了!
    kisara
        21
    kisara  
       Feb 11, 2019
    git 就是 git 跟 linux 有啥关系?
    shily
        22
    shily  
       May 2, 2020 via Android
    @kisara 一个爸爸啊,不一致的话就是爸爸精神分裂啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3197 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 85ms · UTC 13:54 · PVG 21:54 · LAX 06:54 · JFK 09:54
    ♥ Do have faith in what you're doing.