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

2021-11-05 09:39:45 +08:00
 yazoox
root\
  sub1\
  sub2\
    components\
  sub3\
    states\
      core\
  ...

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

谢谢

1937 次点击
所在节点    git
7 条回复
dinghmcn
2021-11-05 09:47:00 +08:00
git log root\sub2\components\
不行吗? 子目录也算在内
silenceboychen
2021-11-05 09:47:21 +08:00
git log root\sub2\components or git log root\sub3\states\core
dinghmcn
2021-11-05 09:51:57 +08:00
@dinghmcn #1 要同是显示这两个目录可以:
git log -- root\sub2\components\ root\sub3\states\core\

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

yyds
ryncv
2021-11-05 09:56:17 +08:00
推荐一个工具: tig 可以很方便实现你要的效果 直接 tig sub2 就可以
yazoox
2021-11-05 11:09:41 +08:00
试了试命令
git log d07cc202a..HEAD --oneline -- path/to/my-filder
是可以工作的。
楼主的工具我也会去试试。
谢谢!
risky
2021-11-06 16:15:25 +08:00
可以试试 git kraken 功能很强

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/813196

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX