V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
yazoox
V2EX  ›  git

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

  •  
  •   yazoox · Nov 5, 2021 · 2816 views
    This topic created in 1638 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
        1
    dinghmcn  
       Nov 5, 2021
    git log root\sub2\components\
    不行吗? 子目录也算在内
    silenceboychen
        2
    silenceboychen  
       Nov 5, 2021
    git log root\sub2\components or git log root\sub3\states\core
    dinghmcn
        3
    dinghmcn  
       Nov 5, 2021
    @dinghmcn #1 要同是显示这两个目录可以:
    git log -- root\sub2\components\ root\sub3\states\core\

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

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