git
› Pro Git
› Atlassian Git Tutorial
› Pro Git 简体中文翻译
› GitX
yazoox
V2EX  ›  git

Git 能够搜索出来这样的 commit 么?改动了某一个或多个指定目录下文件的所 commit

  •  
  •   yazoox · Nov 5, 2021 · 3438 views
    This topic created in 1826 days ago, the information mentioned may be changed or developed.
    root\
      sub1\
      sub2\
        components\
      sub3\
        states\
          core\
      ...
    
    

    我现在想找到所有的 commits ,这些 commits 里面包含有文件在 root\sub2\components\ or root\sub3\states\core\ 下面(在它们的子目录下也算在内)?

    谢谢

    7 replies  •  2021-11-06 16:15:25 +08:00
    dinghmcn
    dinghmcn
    Nov 5, 2021
    1
    git log root\sub2\components\
    不行吗? 子目录也算在内
    silenceboychen
    silenceboychen
    Nov 5, 2021
    2
    git log root\sub2\components or git log root\sub3\states\core
    dinghmcn
    dinghmcn
    Nov 5, 2021
    3
    @dinghmcn #1 要同是显示这两个目录可以:
    git log -- root\sub2\components\ root\sub3\states\core\

    git log -h 看看语法,path 可以多个
    shellus
    shellus
    Nov 5, 2021
    4
    IDEA:打开文件或者选择目录的情况下,点击右上角的时钟图标,下方 git 工具栏就是更改了本文件的所有 commit 列表,点击 commit ,或者多选 commit ,右侧出现影响的文件的 diff 列表,双击可查看更改差异

    yyds
    ryncv
    ryncv
    Nov 5, 2021
    5
    推荐一个工具: tig 可以很方便实现你要的效果 直接 tig sub2 就可以
    yazoox
    yazoox
    OP
    Nov 5, 2021
    6
    试了试命令
    git log d07cc202a..HEAD --oneline -- path/to/my-filder
    是可以工作的。
    楼主的工具我也会去试试。
    谢谢!
    risky
    risky
    Nov 6, 2021
    7
    可以试试 git kraken 功能很强
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5653 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 03:06 · PVG 11:06 · LAX 19:06 · JFK 22:06
    ♥ Do have faith in what you're doing.