V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
gouchaoer2
V2EX  ›  程序员

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

  •  
  •   gouchaoer2 · 2019-02-02 09:49:04 +08:00 · 3886 次点击
    这是一个创建于 1881 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    22 条回复    2020-05-02 16:37:23 +08:00
    lululau
        1
    lululau  
       2019-02-02 09:52:49 +08:00
    除了是一个爸爸之外,这俩还有啥关心?
    lululau
        2
    lululau  
       2019-02-02 09:52:54 +08:00
    关系
    secondwtq
        3
    secondwtq  
       2019-02-02 09:53:00 +08:00 via iPhone   ❤️ 1
    那是 unix 哲学,不是 linux 哲学
    tempdban
        4
    tempdban  
       2019-02-02 09:53:55 +08:00
    git clean -df
    gouchaoer2
        5
    gouchaoer2  
    OP
       2019-02-02 09:55:42 +08:00
    @tempdban 这个管用,3q
    tempdban
        6
    tempdban  
       2019-02-02 09:58:09 +08:00
    @gouchaoer2 不是你连 help 都不看的么,上来就怼?
    gouchaoer2
        7
    gouchaoer2  
    OP
       2019-02-02 10:05:29 +08:00
    @tempdban 我错了还不行么?
    gouchaoer2
        8
    gouchaoer2  
    OP
       2019-02-02 10:06:07 +08:00
    一个 lfs 特性都做不好,每次 check out 都出问题我也很无奈啊
    frylkrttj
        9
    frylkrttj  
       2019-02-02 10:06:13 +08:00
    比我还菜系列
    gouchaoer2
        10
    gouchaoer2  
    OP
       2019-02-02 10:06:55 +08:00
    @frylkrttj 是的,在用 git 上比你菜,但不是所有的事情都比你菜哦
    frylkrttj
        11
    frylkrttj  
       2019-02-02 10:10:37 +08:00
    @frylkrttj 不服看看我刚发的帖子。百度都被我翻烂了都没找到我要得。
    newmind
        12
    newmind  
       2019-02-02 10:17:44 +08:00
    这一点有的时候会坑人
    本机目录是存在的
    同步到其他机器上运行提示目录不存在
    那么多空目录需要添加.gitkeep
    麻烦
    sdijeenx
        13
    sdijeenx  
       2019-02-02 11:08:05 +08:00   ❤️ 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 那样思考”的人们会为此做好准备。

    让我们继续,做一件事情并把它做好,最后你的辛苦必将获得回报。
    sdijeenx
        14
    sdijeenx  
       2019-02-02 11:16:50 +08:00
    junjieyuanxiling
        15
    junjieyuanxiling  
       2019-02-02 13:17:23 +08:00 via Android
    Linus 的哲学是实用……
    junjieyuanxiling
        16
    junjieyuanxiling  
       2019-02-02 13:43:03 +08:00 via Android
    @gouchaoer2 lfs 是 git 的扩展,git 本质上是个源代码管理软件。要管理二进制大文件可以用 OSTree。
    reus
        17
    reus  
       2019-02-02 13:53:16 +08:00
    无能狂怒
    reus
        18
    reus  
       2019-02-02 13:54:34 +08:00   ❤️ 2
    何况 lfs 又不是 git 官方的,是 github 开发的扩展,这都能怼到 linux 头上,不知所谓。
    loading
        19
    loading  
       2019-02-02 14:00:40 +08:00 via Android   ❤️ 2
    建议提 pr,看他爸爸能不能把你喷飞。
    gouchaoer2
        20
    gouchaoer2  
    OP
       2019-02-02 14:23:51 +08:00
    @reus 我怎么这么菜呢?气死我了!
    kisara
        21
    kisara  
       2019-02-11 19:25:24 +08:00
    git 就是 git 跟 linux 有啥关系?
    shily
        22
    shily  
       2020-05-02 16:37:23 +08:00 via Android
    @kisara 一个爸爸啊,不一致的话就是爸爸精神分裂啊
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1186 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 18:22 · PVG 02:22 · LAX 11:22 · JFK 14:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.